Multi-column foreign keys #76
Labels
feature
high priority
schema
things related to the DDL related objects like Table, Column, CreateIndex, etc.
Milestone
Migrated issue, originally created by Anonymous
(original reporter: rtl) SQLAlchemy already supports multi-column primary keys but doesn't support their 'mirror image', multi-column foreign keys. Ideally, the current foreign key syntax should be extended to support specifying multiple columns and the output will need to be in the format of a separate constraint:
e.g.
create table foo (
col1 integer primary key,
col2 integer primary key
)
create table foo2 (
col1 integer primary key,
foo_col1 integer,
foo_col2 integer
)
FOREIGN KEY( foo_col1, foo_col2) REFERENCES foo(col1, col2)
As foreign keys are a type of constraint, it would be useful to base them on a separately constructable Constraint object, which is needed in any case when two tables are mutually dependent on each other. Constraint, while handling create/drop functionality like anything else, could also apply foreign key objects to the relevant Column objects as well so you can specify them in place of the usual foreign key objects.
The text was updated successfully, but these errors were encountered: