How to define migrations
In Sequel, we need to define
migrations to create tables. Migration is a systematic procedure to change the schema of our database from one version to another. So, in our case, we will have numbered files (001, 002, ... ) representing a new version. Sequel handles the migration files automatically and always checks for the newest file.
The users table
Currently, our database is empty and has no tables in it. The first schema change will be the first migration. So, let's write a
001_create_users_table.rb file in the
db/migrations/ folder. Note that the filename can be anything as long as it starts with the proper number. We can also have
1_some_file_name. The leading zeros are not mandatory. Also, the first migration is numbered ...