ruby on rails - Irreversible Migrations - warning & confirm instead of abort? -
i've been writing migrations lately fall under irreversible migration umbrella. aren't end of world irreversible. roll them if want. scenario have @ moment changing 1 many relationship many many relationship. involves dropping column , making new join table. (as 2 lines in models).
i thinking, instead of aborting down migration, "this migration [insert scary message here], sure want proceed? y/n" , roll migration if choose to? put migration inside if statement?
it's easy enough make migrations irreversible, , there's reason (e.g. data can't recovered). these issues resolved writing migration manually?
in noobish mind it'd nice have happy medium. wise? maybe don't understand when make them non-reversible in first place.
i try make migration reversible if possible. time think i've run problems when go coarsely defined data model finer grained on, , again. don't see reason not use solution though, depending of course, on consequences of migration. there nothing stopping person running down migration commenting out raised error , writing own code reverse migration, far safer you, person writing data model change know how transform previous state instead of them guessing.
Comments
Post a Comment