On Fri, Jan 22, 2016 at 01:44:38PM +0100, Michal Petrucha wrote:
> Can anyone help me come up with the best way of renaming a Boolean
> column on both backends? I'm about to try creating a new column with
> the new name, copying the data from the old column, and dropping the
> old one, but that's a really convoluted approach.

...and just now I realized that won't work either, because there's a
bug in the batch implementation of drop_column. Funnily enough, it was
only yesterday that I submitted a PR for that particular bug
(https://bitbucket.org/zzzeek/alembic/pull-requests/53/ for those who
are interested). Which means even my brute-force fallback solution is
a no go, at least for the time being.

In light of that, can anyone come up with a solution that does not
involve any of the following:
- a straight-up rename of a Boolean column,
- changing Boolean to Integer, and
- dropping a Boolean column?

Changing the type from Boolean() to Boolean(create_constraint=False)
has the same effect as changing to Integer().

Or maybe -- can I drop the CHECK constraint manually? What I mean is,
is it guaranteed that the constraint will be there for all backends,
even those with a native boolean type? (That appears to be the case
for MS SQL, but I'm curious if it holds for other backends as well.)
If the only condition for creating the constraint is
create_constraint=True (regardless of the backend's capabilities),
this might be a way forward.

Cheers,

Michal

-- 
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 sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to