You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I migrated an old project over to using project.yaml, deployed it on my staging system and pressed the apply changes button. During the migrations it complained that it had no write permissions to copy the project.yaml somewhere?
Why doesn't craft check if all requirements are met on the host BEFORE running destructive migrations? Why are migrations not atomic and revers-able in case an error like the one I mentioned above occurs?
Steps to reproduce
Have old craft version on target host
Have permission problem
Start project.yaml sync
Profit
The text was updated successfully, but these errors were encountered:
One issue here is that MySQL does not really respect transactions if a table needs to be altered, so transactions cannot help to make it atomic. (reference)
As far as reversibility goes, it's also not that simple. All of the migrations supplied by Craft are not reversible for the simple reason that the codebase expects a certain schema to be in place. If migrations were allowed to be reversible, you could end up in a situation where code tried to execute a query on a database schema it expected only to find out that the table structure is not what was expected.
One more trickiness is if a migration fails somewhere in-between (how it happened for you), where it becomes super-awkward, as MySQL commits the transaction every time a table is altered, leaving it in a messed up state.
The first order of business here is to move the project config file to a place that's writable, though, so I'll start with that.
Description
I migrated an old project over to using project.yaml, deployed it on my staging system and pressed the apply changes button. During the migrations it complained that it had no write permissions to copy the project.yaml somewhere?
And now my database is broken:
Why doesn't craft check if all requirements are met on the host BEFORE running destructive migrations? Why are migrations not atomic and revers-able in case an error like the one I mentioned above occurs?
Steps to reproduce
The text was updated successfully, but these errors were encountered: