-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial_yml_and_snapshot migration failed, no transaction rollback Craft 3.1 #3652
Comments
I have the same error:
I did the upgrade to 3.1.1 in local first, then I created the project.yaml and deployed everything on preprod. And it's on preprod, when running the migrations that I had the error. |
Also, I tried to delete the columns config and configMap in the database and I re-runned the migrations and I have this error now:
|
Migrations shouldn't have to worry about cleaning up after past failed migrations... that’s what database backups and restores are for. Otherwise every line of every migration is going to need to start being defensive. And many migrations make “lossy” changes that wouldn’t be able to be guarded against even if we wanted to. And worth noting that PostgreSQL doesn’t have this problem, only MySQL, because MySQL auto-commits transactions as soon as the schema is changed in any way, whereas PostgreSQL will be able to roll back all of its changes in the event of an error. |
Good for PostgreSQL, not so good for the rest of us. |
Agreed but what you’re asking is like playing whack-a-mole with 10,000 mole holes. |
Description
The
initial_yml_and_snapshot
migration adds theconfig
andconfigMap
field to theinfo
table.When the something fails later in
_getProjectConfigData()
, e.g. in my case it was a missing arrayindex, the migration fails.
Craft/Yii will try to run the migration again, as it wasn't finished. However the columns in the
info
table still exist. Then you run into another issueColumn already exists: 1060 Duplicate column name 'config'
.Removing the column manually (and upgrading to 3.1.1) solved it eventually for me.
Idea: Add the columns only if they don't exist.
Additional info
The text was updated successfully, but these errors were encountered: