sql scripts for label support

This commit is contained in:
Ezequiel Bergamaschi 2014-01-25 23:07:18 -03:00 committed by Ezequiel Bergamaschi
parent 02cb53d082
commit 504e3e18e6
6 changed files with 57 additions and 0 deletions

View File

@ -32,6 +32,22 @@ CREATE TABLE MINDMAP (
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
); );
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY IDENTITY,
title VARCHAR(255),
creator_id INTEGER NOT NULL,
parent_label_id INTEGER
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
);
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
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)
);
CREATE TABLE MINDMAP_HISTORY CREATE TABLE MINDMAP_HISTORY
(id INTEGER NOT NULL IDENTITY, (id INTEGER NOT NULL IDENTITY,
xml LONGVARBINARY NOT NULL, xml LONGVARBINARY NOT NULL,

View File

@ -3,6 +3,7 @@ DROP TABLE IF EXISTS TAG;
DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
DROP TABLE IF EXISTS MINDMAP_HISTORY; DROP TABLE IF EXISTS MINDMAP_HISTORY;
DROP TABLE IF EXISTS LABEL;
DROP TABLE IF EXISTS MINDMAP; DROP TABLE IF EXISTS MINDMAP;
DROP TABLE IF EXISTS USER; DROP TABLE IF EXISTS USER;
DROP TABLE IF EXISTS COLLABORATOR; DROP TABLE IF EXISTS COLLABORATOR;

View File

@ -48,6 +48,29 @@ CREATE TABLE MINDMAP (
) )
CHARACTER SET utf8; CHARACTER SET utf8;
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
creator_id INTEGER NOT NULL,
parent_label_id INTEGER,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
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)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
CREATE TABLE MINDMAP_HISTORY CREATE TABLE MINDMAP_HISTORY
(id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, (id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,

View File

@ -3,6 +3,7 @@ DROP TABLE IF EXISTS ACCESS_AUDITORY;
DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
DROP TABLE IF EXISTS MINDMAP_HISTORY; DROP TABLE IF EXISTS MINDMAP_HISTORY;
DROP TABLE IF EXISTS LABEL;
DROP TABLE IF EXISTS MINDMAP; DROP TABLE IF EXISTS MINDMAP;
DROP TABLE IF EXISTS USER; DROP TABLE IF EXISTS USER;
DROP TABLE IF EXISTS COLLABORATOR; DROP TABLE IF EXISTS COLLABORATOR;

View File

@ -19,6 +19,21 @@ CREATE TABLE "user" (
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ON DELETE CASCADE ON UPDATE NO ACTION FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ON DELETE CASCADE ON UPDATE NO ACTION
); );
CREATE TABLE LABEL (
id INTEGER NOT NULL PRIMARY KEY,
title VARCHAR(255),
creator_id INTEGER NOT NULL,
parent_label_id INTEGER
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
);
CREATE TABLE R_LABEL_MINDMAP (
mindmap_id INTEGER NOT NULL,
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)
);
CREATE TABLE MINDMAP ( CREATE TABLE MINDMAP (
id SERIAL NOT NULL PRIMARY KEY, id SERIAL NOT NULL PRIMARY KEY,

View File

@ -3,6 +3,7 @@ DROP TABLE ACCESS_AUDITORY;
DROP TABLE COLLABORATION; DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES; DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY; DROP TABLE MINDMAP_HISTORY;
DROP TABLE LABEL;
DROP TABLE MINDMAP; DROP TABLE MINDMAP;
DROP TABLE "user"; DROP TABLE "user";
DROP TABLE COLLABORATOR; DROP TABLE COLLABORATOR;