Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 865 Bytes

database_practices.md

File metadata and controls

18 lines (15 loc) · 865 Bytes
  • use singular nouns for database tables ex. ad_campaign, ad__placement

  • while writing SQLs, use RETURNING to fetch data after Write/ Update operation is done that way I don't have to make another call to fetch latest version of data.

INSERT INTO ad_targeting (ad_id, geo_location_lat, geo_location_long) VALUES(7, 47, -122)
RETURNING id, geo_location_lat, geo_location_long;
  • always keep a full version of schema in folder db/. so that someone can recreate the database locally
  • always write migration scripts inside db/ folder

read: