- attached schema.diff
foreign key objects don't copy() all args
Issue #1605
resolved
Hi All
ForeignKey and ForeignKeyConstraint copy() method make FK copy without
arguments, for example deferrable, ...
class ForeignKey:
def copy(self, schema=None):
"""Produce a copy of this ForeignKey object."""
return ForeignKey(self._get_colspec(schema=schema))
class ForeignKeyConstraint:
def copy(self, **kw):
return ForeignKeyConstraint(
[for x in self._elements.values()](x.parent.name),
[for x in
self._elements.values()](x._get_colspec(**kw)),
name=self.name,
onupdate=self.onupdate,
ondelete=self.ondelete,
use_alter=self.use_alter
)
Comments (3)
-
Account Deleted -
reporter thanks for the patch, it is in f8e098544bd5f8d23b15453ee94cf0560dac747e. the "constraint" argument references another
ForeignKeyConstraint
so you wouldn't want that passed along in a copy, but I've made that argument private anyway. -
reporter - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
schema.diff