April 2018
Beginner to intermediate
406 pages
9h 33m
English
Hooray! We've created our migrations, and run them successfully! Now, we have our representation of the first table in our models. We’ll continue on with creating another migration for our Options since our data model will be woefully incomplete without it! Let's begin:
$ mix ecto.gen.migration add_options_table* creating priv/repo/migrations* creating priv/repo/migrations/20171005185040_add_options_table.exs
If we open up the file, we’ll see the same skeleton we started within our last file. The new things we'll be using here are default values, and references as well! If you remember the design of our Options table, we have a title (which is a string), the votes (which is an integer counter of the number ...