Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dtinianow/365ab1584c032a7a0b95d999c44725ee to your computer and use it in GitHub Desktop.
Save dtinianow/365ab1584c032a7a0b95d999c44725ee to your computer and use it in GitHub Desktop.
What is a primary key?

Totally unique identifier for a table A primary key automatically generates and increments from previous record (never reused)

What is a foreign key?

A primary key of a table that is used in another table to relate the two tables

Why would one row of data have both primary and foreign keys?
What is Rails' convention for the column name of the primary key?

id

What is Rails' convention for the column name of a foreign key?

foreign_table_id

What are dev, test, and prod databases all about?

production - the final product that stores actual user data dev - experimenting with the database to figure out what works best test - database used to test specific cases and help build out the database in a specific way

What is the database.yml and how is it used?

It contains some configuration settings and tells each environment where to go(where each file for the database is stored)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment