How to Add a Field to a Generated Table Retroactively

From ElixirBlocks
Revision as of 05:33, 29 May 2023 by Admin (talk | contribs)
Jump to: navigation, search

This page is in progress


First, generated data is created. This is an example:


mix phx.gen.html TestBeds TestBed  testbeds name:string url:string

Generate a migration file

To add a field, you must first generate a migration file. The migration file is an empty file that is generated using a command. After it is generated you write code and invoke it.

The command is:

mix ecto.gen.migration name_of_migration

For this example, I will add a new field named owner

mix ecto.gen.migration create_owner_field