I've made two tables, Table1 and Table2. Each table contains a primary key. The primary key of Table1 is ref1 and the primary key of Table2 is ref2.
After adding a composition and specifying the Source Role (ref1) and Target Role (PK_Table2), the project view shows a foreign key.
After generating the DDL, I find the following :
-- Drop Foreign Key Constraints
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id('FK_ref1') AND OBJECTPROPERTY(id, 'IsForeignKey') = 1)
ALTER TABLE Table1 DROP CONSTRAINT FK_ref1
;
-- Drop Tables
IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE id = object_id('Table1') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE Table1
;
IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE id = object_id('Table2') AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE Table2
;
-- Create Tables
CREATE TABLE Table1 (
ref1 int NOT NULL
)
;
CREATE TABLE Table2 (
ref2 int NOT NULL
)
;
-- Create Primary Key Constraints
ALTER TABLE Table1 ADD CONSTRAINT PK_Table1
PRIMARY KEY (re)
;
ALTER TABLE Table2 ADD CONSTRAINT PK_Table2
PRIMARY KEY (ref2)
;
I do not understand why there is a "drop foreign key constraint" but no "create foreign key constraint". Is anything wrong in my model or is this an EA bug ?
I'm using EA version 4.51.751.
Regards,
Bart