Closed sqlalchemy-bot closed 7 years ago
Michael Bayer (zzzeek) wrote:
hello -
again this is totally vague. Are you talking about the order of ops as rendered, or the comments added, or what? What is being "cached"? What is the model change that would generate such output ? I have no idea how Alembic would somehow suggest where in code it generates that other arbitrary code might be added? Feel free to propose a pull request if you feel this is easy (as the title mentions).
Michael Bayer (zzzeek) wrote:
as discussed in https://bitbucket.org/zzzeek/alembic/issues/452/create_unique_constraint-not-working-with#comment-39941968 this needs to be reproposed in terms of specific, well defined behaviors and preferably demonstrations of new rulesets.
Migrated issue, originally created by Matt Jernigan (juanitogan)
I just went through the model change of a major app update that added a new level of hierarchy to most tables, and learned a lot about Alembic in the process. Alembic could have saved me a few hours if it cached and rendered the detected changes as follows -- with the following hints as well as to where I might need to add my own changes:
Well, more or less. I can't say I got the exact order right (if its even possible given that new tables may need a foreign key to a PK or index that was just dropped -- so maybe FKs on all new tables should be saved for later). Also note that I split out the
nullable = False
part of new columns until after the DML loading -- very helpful.Anyhow, regardless of exact order of it all (which I didn't spend too much time on here), I hope the idea is clear -- and I hope this also helps get Alembic closer to auto working with PKs.