diff --git a/config/database/hsql/create-schemas.sql b/config/database/hsql/create-schemas.sql index d98d4694..7f88533c 100644 --- a/config/database/hsql/create-schemas.sql +++ b/config/database/hsql/create-schemas.sql @@ -1,7 +1,8 @@ CREATE TABLE COLLABORATOR ( id INTEGER NOT NULL IDENTITY, email VARCHAR(255) NOT NULL, - creation_date DATE); + creation_date DATE +); CREATE TABLE USER ( id INTEGER NOT NULL IDENTITY, @@ -46,25 +47,26 @@ CREATE TABLE R_LABEL_MINDMAP ( label_id INTEGER NOT NULL, PRIMARY KEY (mindmap_id, label_id), FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id), - FOREIGN KEY (label_id) REFERENCES LABEL (id) + FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION ); -CREATE TABLE MINDMAP_HISTORY -(id INTEGER NOT NULL IDENTITY, +CREATE TABLE MINDMAP_HISTORY ( + id INTEGER NOT NULL IDENTITY, xml LONGVARBINARY NOT NULL, mindmap_id INTEGER NOT NULL, creation_date DATETIME, editor_id INTEGER NOT NULL, - FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)); + FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id) +); -CREATE TABLE COLLABORATION_PROPERTIES -(id INTEGER NOT NULL IDENTITY, +CREATE TABLE COLLABORATION_PROPERTIES ( + id INTEGER NOT NULL IDENTITY, starred BOOLEAN NOT NULL, mindmap_properties VARCHAR(512) ); -CREATE TABLE COLLABORATION -(id INTEGER NOT NULL IDENTITY, +CREATE TABLE COLLABORATION ( + id INTEGER NOT NULL IDENTITY, colaborator_id INTEGER NOT NULL, properties_id INTEGER NOT NULL, mindmap_id INTEGER NOT NULL, @@ -75,8 +77,8 @@ CREATE TABLE COLLABORATION ); -CREATE TABLE TAG -(id INTEGER NOT NULL IDENTITY, +CREATE TABLE TAG ( + id INTEGER NOT NULL IDENTITY, name VARCHAR(255) NOT NULL, user_id INTEGER NOT NULL, --FOREIGN KEY(user_id) REFERENCES USER(colaborator_id) diff --git a/config/database/postgres/create-schemas.sql b/config/database/postgres/create-schemas.sql index 1c52115c..308e8ac7 100644 --- a/config/database/postgres/create-schemas.sql +++ b/config/database/postgres/create-schemas.sql @@ -33,7 +33,7 @@ CREATE TABLE R_LABEL_MINDMAP ( label_id INTEGER NOT NULL, PRIMARY KEY (mindmap_id, label_id), FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id), - FOREIGN KEY (label_id) REFERENCES LABEL (id) + FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE MINDMAP (