hey all! long story short:
- created new migration to add new column
- add new column as field to schema file
- works fine and migrates
- upon resetting db and running all migrations, conflict from earlier migration which queries schema
Repo.all(Table)
- seems like the problem is that the schema claims there is a column and the earlier migration doesn’t agree the column exists.
details:
I’ve created a migration to add a new column to an existing table. I’ve added said column as a field in the schema file. Running this migration works perfectly.
when I reset the DB and run all of the migrations, i run into an error ** (Postgrex.Error) ERROR 42703 (undefined_column) column v0.newly_added_column_name does not exist
.
I see an earlier timestamped migration calls to the table with case Repo.all(Table) do
, and upon reading more Ecto docs i believe this line of code is referring to the Schema file with a field that hasnt been created yet since the migration which creates this column comes later. Is there a way to handle this outside of touching migration files? my initial idea is to recreate this migration w/ the line case Repo.all(Table)
in order to let the migration which adds the new column happen first. I’d prefer not to touch previous migrations, but can if need be!