qizhiyi / sqlalchemy-migrate

Automatically exported from code.google.com/p/sqlalchemy-migrate
MIT License
0 stars 0 forks source link

migrate.changeset.constraint.ForeignKeyConstraint.autoname produces wrong result (PostgreSQL) #101

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a table with a foreign key constraint to another table in a first 
changeset
2. drop the constraint in another changeset

both can be accomplished by running migrate version_control and migrate upgrade 
on a postgresql database using the attached changesets

What is the expected output? What do you see instead?

Dropping should work, but instead the upgrade crashes with

sqlalchemy.exc.ProgrammingError: (ProgrammingError) ERROR:  constraint 
»table2_table1_fkey« of relation »table2« does not exist
 'ALTER TABLE table2 DROP CONSTRAINT table2_table1_fkey' {}

Original issue reported on code.google.com by jan.ditt...@gmail.com on 7 Nov 2010 at 8:33

Attachments:

GoogleCodeExporter commented 8 years ago
PostgreSQL uses autogenerated foreign key names of the form

<table>_<first_refcol_name>_fkey

but migrate generates

<table>_<reftable>_fkey

Original comment by jan.ditt...@gmail.com on 7 Nov 2010 at 9:03

GoogleCodeExporter commented 8 years ago
err...

<table>_<first_col_name>_fkey

Original comment by jan.ditt...@gmail.com on 7 Nov 2010 at 9:12

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ec541a9286.

Original comment by jan.ditt...@gmail.com on 7 Nov 2010 at 9:21