ilyakatz / data-migrate

Migrate and update data alongside your database structure.
MIT License
1.4k stars 192 forks source link

`db:migrate:with_data` ignores schema migrations after `9.2.0` #332

Closed fmichaut-diff closed 1 week ago

fmichaut-diff commented 2 weeks ago

We kinda recently updated data-migrate to 9.4.2 and started running into issues of schema migrations not beeing run by our deployment script (using db:migrate:with_data).

We did not really understood what was going on, and ended up manually running db:migrate which ran the schema migrations as expected. Today, I was running into a similar issue where I had a data migration dependent of a previous schema migration. with_data should execute the schema migration first (because of early timestamp) and then the data migration, but did not run the schema migration and crashed because the new DB column was not created.

I stumbled onto this PR : https://github.com/ilyakatz/data-migrate/pull/296/files which is refactoring a lot of things related to how you detect the migrations to run, and reverting to 9.2.0 fixed my issue : data-migrate picked up schema migrations again.

So it looks like a breaking change for with_data was introduced after 9.2.0, i'm assuming 9.3 which is where you released PR#296, but I didn't test more than that

langsharpe commented 1 week ago

We had a similar issue. I think it was the rails bump from 7.1.3.4 to 7.1.4 that triggered the issue for us(we were already running 9.4.2).

I've upgraded our app to use 11.0.0.rc3 and migrate:with_data is doing both types of migrations again.

bruno-costanzo commented 1 week ago

Yes, update to the RC, with are making it the main branch soon.

Morozzzko commented 1 week ago

I like the thoroughness of the bug description, thank you!

11.0.0 has been released with the relevant bugfix. Please let us know if you're still facing any issues