fix generation of foreign key constraint name in

migrate.changeset.constraint.ForeignKeyConstraint.autoname

use <table>_<firstcol>_fkey instead of <table>_<reftable>_fkey

Fixes Issue 101
This commit is contained in:
Jan Dittberner 2010-11-07 22:19:36 +01:00
parent eb6e2eea24
commit 73796f3e54

@ -126,9 +126,9 @@ class ForeignKeyConstraint(ConstraintChangeset, schema.ForeignKeyConstraint):
def autoname(self):
"""Mimic the database's automatic constraint names"""
ret = "%(table)s_%(reftable)s_fkey" % dict(
ret = "%(table)s_%(firstcolumn)s_fkey" % dict(
table=self.table.name,
reftable=self.reftable.name,)
firstcolumn=self.columns[0],)
return ret