Rails will also create an primary key called model_id that auto-increments (1,2,3,...) with every row.You can choose from a variety of datatypes that go with Active Record. The command is able to create the table and all the necessary columns inside the table.
Rake also knows what migrations are already in the database so it won't overwrite your tables. To add a connection between your tables we want to add references in our model.To restore the state of the database as it was, say 5 migrations before the current, we can use Choose whether you want the db_migrate:up method to be executed or the db_migrate:down method Keep in mind, that restoring your database to a previous state will delete already inserted data completely! This is what you should be using for the vast majority of cases.Let’s create one to add genres: If you exit the console, and run it again to check the first movie title, it will have the original title.This is very useful for production debugging, like when a user says that updating the profile name he gets some weird error.