Does following ways are correct way of modifying the Database?

I want to change the database without resetting the database as my code is shared with others as well, so resetting database won’t help. Following are steps that I follow-

  • created new migration file(command- mix ecto.gen.migration file_name). added following things
  def change do
    alter table(:table_name) do
      add :is_public, :boolean, default: false
    end
  end
  • Then, Run command- mix ecto.migrate.
  • In terminal-
[info] alter table table_name
[info] == Migrated 20190523081803 in 0.2s
  • Still, inside my schema file, the field was not added.

Now, what should I do, whether I manually edit this schema file then run some command(if yes, then tell those command) or If no, then what is the correct way. Your response will be highly appreciable. Thank You

After migrating you have to manually modify the schema module accordingly.

2 Likes

And then. All done.

Thanks it work.

You’re welcome :slight_smile: