faouzzz / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Support for Multi-Column Foreign Keys #110

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It seems wwwsqldesigner is only implementing column constraint logic for 
foreign keys, but not table constraint logic and is thus only allowing single 
column constraints for foreign keys.

Support for Multi-Column Foreign Keys is missing.

Many databases support multicolumn primary keys. Foreign keys usually refer to 
a primary (or unique) key of a table, hence need to contain the same number and 
type of columns of the referenced key (for unique or single column primary 
keys, this is then a single column constraint).

ORACLE:
=======
All foreign key columns referenced in constraint must be NOT NULL.

For definition of foreign keys in oracle DB, see
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/clauses002.htm#SQ
LRF01111
example: CONSTRAINT FK_EXAMPLE_1 FOREIGN KEY (column1, column2, column3) 
REFERENCES TABLE_1 ( column_x, column_y, column_z);

POSTGRESQL:
===========
http://www.postgresql.org/docs/9.0/static/sql-createtable.html

CONSTRAINT FK_PGSQL_EXAMPLE_1 FOREIGN KEY ( column_name [, ... ] ) REFERENCES 
reftable [ ( refcolumn [, ... ] ) ]

For postgresql it is possible to have some parts of the FK to be null depending 
on the MATCH type.

MYSQL:
======
(innodb). See:
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

MSSQL:
======
Table constraint. See Create Table syntax:
http://msdn.microsoft.com/en-us/library/ms174979.aspx

Original issue reported on code.google.com by hk...@gmx.de on 15 Oct 2010 at 1:42

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 15 Oct 2010 at 1:56