What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?
- Primary key determines uniqueness of an entry in a table (generally, but not necessarily "id")
- Foreign key references an entry in another table (by its primary key) ("foreignTableName_id")
- Spouses/Couples, Person-SSN,
- House-Occupants, School-Students
- Albums-Artists, Students-Classes, Video Games-Players
- Test is for running your test suite, generally wiped during each test2
- Development is for interacting during development
- Production is for the live data from the real world
- rails new appname -d postgresql
- A migration
- A model
- A model test
- Fixtures