migration "MoveStylesToContent" fails
Support Ticket
+issues
When attempting upgrade from 1.11.7 to 1.12.5, wagn:migrate successfully applies AddStyleCards and then crashes in MoveStylesToContent with:
== MoveStylesToContent: migrating ============================================
rake aborted!
An error has occurred, this and all later migrations canceled:
Validation failed: Codename codename already in use
By running commands in a rails console, it's clear that the update_attributes! call fails for all of the style cards when trying to set :codename to nil. My suspicion -- which I haven't verified -- is that a validation was added sometime after that card migration was created, so it used to work fine in some intermediate version.
To work around this, I changed the migration so that it only sets :content (which worked fine) and then eliminated codename for those records directly in the database ('update cards set codename = null where id in (...)'). This worked fine, but is probably a little bit too invasive to expect everyone who's gotten a few releases behind to do.