the error indicates you're making use of the "naming_convention" feature of
MetaData, and that the naming convention applied to unique constraints requires
that it derive the name from some of the constrained columns. Is this the case?
If you want to force the name to be unmodified when using the naming_convention
feature, wrap op.f("<yourname>") around the name, see
http://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.f.
I see that op.f() is present for the add_constraint but not the drop. Is this
script purely generated by autogenerate? If so, and autogen is applying f()
only to the add and not the drop, that would be an alembic bug.
On Aug 18, 2014, at 9:16 AM, Stephan Hügel <[email protected]> wrote:
> I'm attempting to drop a unique constraint on MySQL 5.6.20, 64-bit, Python
> 2.7.6, SQLA 0.9.7, Alembic 0.6.6:
>
> The table's very simple:
>
> CREATE TABLE `author` (
> `id` int(11) NOT NULL AUTO_INCREMENT,
> `name` varchar(75) CHARACTER SET utf8 NOT NULL,
> `foo` varchar(100) DEFAULT NULL,
> PRIMARY KEY (`id`),
> UNIQUE KEY `name` (`name`)
> ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
>
> But when I attempt to drop the unique constraint on foo using
> op.drop_constraint(u'uq_author_foo', 'author', type_='unique'), I get an
> error:
>
> https://gist.github.com/urschrei/541fec05a3a82d71cbe9
>
> Manually removing it, both on the command line and in Sequel Pro, works fine.
>
> --
> s
>
>
>
>
> --
> 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.
--
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.