Re: How to handle changing formerly-unnamed constraints (and retrying after errors in migration scripts)

2016-04-21 Thread Ben Sizer
Aha, thanks for that. For the benefit of anyone who comes across this later, my final script looked much like this: def downgrade(): try: inner_transaction = op.get_bind().begin_nested() # establish a savepoint with op.batch_alter_table("user_authentication_method") as batch_

Re: How to handle changing formerly-unnamed constraints (and retrying after errors in migration scripts)

2016-04-20 Thread Mike Bayer
On 04/20/2016 07:42 AM, Ben Sizer wrote: I had an unnamed UniqueConstraint, and autogenerated upgrade scripts that passed in None as the name - these worked perfectly. Now I am discovering that the downgrade doesn't work, as there is no name to refer to the constraint (i.e. "sqlalchemy.exc.Comp

How to handle changing formerly-unnamed constraints (and retrying after errors in migration scripts)

2016-04-20 Thread Ben Sizer
I had an unnamed UniqueConstraint, and autogenerated upgrade scripts that passed in None as the name - these worked perfectly. Now I am discovering that the downgrade doesn't work, as there is no name to refer to the constraint (i.e. "sqlalchemy.exc.CompileError: Can't emit DROP CONSTRAINT for