I have noticed that when nORMa generates the DDL for a super simple setup for mysql (or postgres or mssql)
and the mysql sql ddl is generated as:
CREATE TABLE Person
(
SSN CHAR(12) NOT NULL,
CONSTRAINT Person_PK PRIMARY KEY(SSN)
);
CREATE TABLE Company
(
companyId INT AUTO_INCREMENT NOT NULL,
CName VARCHAR(16383) NOT NULL,
CONSTRAINT Company_PK PRIMARY KEY(companyId),
CONSTRAINT Company_UC UNIQUE(CName)
);
CREATE TABLE Employment
(
person CHAR(12) NOT NULL,
companyId INT NOT NULL,
CONSTRAINT Employment_PK PRIMARY KEY(person, companyId)
);
CREATE TABLE InterestConflict
(
person CHAR(12) NOT NULL,
companyId INT NOT NULL,
CONSTRAINT InterestConflict_PK PRIMARY KEY(person, companyId)
);
ALTER TABLE Employment ADD CONSTRAINT Employment_FK1 FOREIGN KEY (person) REFERENCES Person (SSN) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE Employment ADD CONSTRAINT Employment_FK2 FOREIGN KEY (companyId) REFERENCES Company (companyId) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE InterestConflict ADD CONSTRAINT InterestConflict_FK1 FOREIGN KEY (person) REFERENCES Person (SSN) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE InterestConflict ADD CONSTRAINT InterestConflict_FK2 FOREIGN KEY (companyId) REFERENCES Company (companyId) ON DELETE RESTRICT ON UPDATE RESTRICT;
Now this would be fine except that the model is super simple: it is the model from the .doc helpfile that installed with nORMa. Nothing but person, conflict of interest, company, and Employment objects and an Exclusion constraint. The exclusion constraint is ignored when creating the DDL. Just wondering what was up with that. Thank you.