I forgot to add timestamps to one of my tables, so I created a new migration to do so:
defmodule Guardian.Repo.Migrations.AddTimestampsToCounties do
def change do
alter table(:counties) do
This works fine locally, but the inserted_at and updated_at field are not being added to the database in production on Fly.io.
/app/bin/guardian eval "Guardian.Release.migration_status()"
Inside of the SSH console says that the migrations are all up, but that is not the case.
Why is this particular migration failing on Fly.io when it works fine locally?
Hmmm…can you log into the database and see the contents of the schema_migrations table to ocnfirm?
The schema_migrations table showed the migration was up too, but the two fields were not in the database. I couldn’t get it to work, so I deleted the app and re-deployed it and it worked fine that time. Definitely not a procedure I want to have to do going forward though.
Yah, that is definitely super-duper odd. I’ve had migrations be in a half-finished state, but this one is perplexing since it said it finished but didn’t do what it said it should have done. I wonder if a rollback followed by migration would have fixed it.
That idea crossed my mind after I had deleted the app (best timing for an idea ever). I’ll try that if this happens again.