Let's get to writing some code to put this all together! We'll start off by building our add_messages_table migration:
$ mix ecto.gen.migration add_messages_table* creating priv/repo/migrations* creating priv/repo/migrations/20171206203035_add_messages_table.exs
We'll want to explicitly have it create the standard Ecto timestamps, as well as our message, author, and poll_id columns. id will be created by default every time, so there's not much we need to do there. Also, since we're relying on a foreign key that will likely be used pretty frequently in our queries, we want to make sure that we're creating an index for that particular column in reference to the correct table. In the priv/repo/migrations/*_add_messages_table.exs ...