On 02/05/2016 01:10 PM, Jonathan Beluch wrote:
Just realized #4 isn't so simple either as the comparison is always done
by name.
if this is a one-time migration why is autogenerate needed at all?
Just write out the migration for all the constraints either manually or
using your own one-off script.
On Friday, February 5, 2016 at 10:46:14 AM UTC-7, Jonathan Beluch wrote:
Hi, I have an existing pg database where I'd like to get the names
in order according to a new naming_convention. However, dropping and
recreating lots of indexes is obviously a bad idea.
I've coded RenameConstraintOp and RenameIndexOp along with the
dispatch functions. I'm trying to figure out the best way to hook
into autogenerate to output a rename instead of a create/drop.
Potential solutions?
* Rewriter doesn't seem like a good fit because it only takes in a
single operation and I want to remove two ops and add a
different op.
* comparison function doesn't seem right either because it only
adds new operations, it doesn't override existing behavior
* traverse the entire migration structure pairwise and compare and
remove add/drop and insert rename
* fork and modify the alembic source
https://github.com/zzzeek/alembic/blob/master/alembic/autogenerate/compare.py#L526
<https://github.com/zzzeek/alembic/blob/master/alembic/autogenerate/compare.py#L526>
for this one off migration
I'm leaning towards 4, since this will be a one time migration (now
that the naming_convention is in place). Please correct my
understandings above if I'm wrong. Thanks!
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.