2012-06-22 06:34:33 +02:00
|
|
|
CREATE TABLE COLLABORATOR (
|
2013-03-18 03:19:29 +01:00
|
|
|
id INTEGER NOT NULL IDENTITY,
|
2022-09-28 16:12:13 +02:00
|
|
|
email VARCHAR(255) NOT NULL UNIQUE,
|
2014-02-01 23:34:29 +01:00
|
|
|
creation_date DATE
|
|
|
|
);
|
2009-06-07 20:59:43 +02:00
|
|
|
|
|
|
|
CREATE TABLE USER (
|
2014-01-30 02:15:26 +01:00
|
|
|
colaborator_id INTEGER NOT NULL IDENTITY,
|
2013-03-18 03:19:29 +01:00
|
|
|
authentication_type CHAR(1) NOT NULL,
|
|
|
|
authenticator_uri VARCHAR(255) NULL,
|
|
|
|
firstname VARCHAR(255) NOT NULL,
|
|
|
|
lastname VARCHAR(255) NOT NULL,
|
|
|
|
password VARCHAR(255) NOT NULL,
|
|
|
|
activation_code BIGINT NOT NULL,
|
|
|
|
activation_date DATE,
|
|
|
|
allow_send_email CHAR(1) NOT NULL,
|
|
|
|
locale VARCHAR(5),
|
|
|
|
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
|
2012-02-21 19:37:15 +01:00
|
|
|
);
|
2009-06-07 20:59:43 +02:00
|
|
|
|
|
|
|
CREATE TABLE MINDMAP (
|
2013-03-18 03:19:29 +01:00
|
|
|
id INTEGER NOT NULL IDENTITY,
|
|
|
|
title VARCHAR(255) NOT NULL,
|
|
|
|
description VARCHAR(255) NOT NULL,
|
|
|
|
xml LONGVARBINARY NOT NULL,
|
|
|
|
public BOOLEAN NOT NULL,
|
|
|
|
creation_date DATETIME,
|
|
|
|
edition_date DATETIME,
|
|
|
|
creator_id INTEGER NOT NULL,
|
2014-01-21 05:46:04 +01:00
|
|
|
last_editor_id INTEGER NOT NULL
|
2012-06-12 16:23:47 +02:00
|
|
|
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
2012-02-21 18:22:43 +01:00
|
|
|
);
|
2009-06-07 20:59:43 +02:00
|
|
|
|
2014-01-26 03:07:18 +01:00
|
|
|
CREATE TABLE LABEL (
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY IDENTITY,
|
2014-01-28 04:13:29 +01:00
|
|
|
title VARCHAR(30),
|
2014-01-26 03:07:18 +01:00
|
|
|
creator_id INTEGER NOT NULL,
|
2014-01-28 04:13:29 +01:00
|
|
|
parent_label_id INTEGER,
|
2014-04-14 23:09:34 +02:00
|
|
|
color VARCHAR(7) NOT NULL,
|
2014-04-16 07:38:33 +02:00
|
|
|
iconName VARCHAR(50) NOT NULL
|
2014-01-26 03:07:18 +01:00
|
|
|
--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),
|
2014-02-01 23:34:29 +01:00
|
|
|
FOREIGN KEY (label_id) REFERENCES LABEL (id) ON DELETE CASCADE ON UPDATE NO ACTION
|
2014-01-26 03:07:18 +01:00
|
|
|
);
|
|
|
|
|
2014-02-01 23:34:29 +01:00
|
|
|
CREATE TABLE MINDMAP_HISTORY (
|
|
|
|
id INTEGER NOT NULL IDENTITY,
|
2013-03-18 03:19:29 +01:00
|
|
|
xml LONGVARBINARY NOT NULL,
|
|
|
|
mindmap_id INTEGER NOT NULL,
|
|
|
|
creation_date DATETIME,
|
|
|
|
editor_id INTEGER NOT NULL,
|
2014-02-01 23:34:29 +01:00
|
|
|
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
|
|
|
|
);
|
2009-06-07 20:59:43 +02:00
|
|
|
|
2014-02-01 23:34:29 +01:00
|
|
|
CREATE TABLE COLLABORATION_PROPERTIES (
|
|
|
|
id INTEGER NOT NULL IDENTITY,
|
2013-03-18 03:19:29 +01:00
|
|
|
starred BOOLEAN NOT NULL,
|
|
|
|
mindmap_properties VARCHAR(512)
|
2012-06-10 03:55:55 +02:00
|
|
|
);
|
|
|
|
|
2014-02-01 23:34:29 +01:00
|
|
|
CREATE TABLE COLLABORATION (
|
|
|
|
id INTEGER NOT NULL IDENTITY,
|
2013-03-18 03:19:29 +01:00
|
|
|
colaborator_id INTEGER NOT NULL,
|
|
|
|
properties_id INTEGER NOT NULL,
|
|
|
|
mindmap_id INTEGER NOT NULL,
|
|
|
|
role_id INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id),
|
|
|
|
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
|
|
|
|
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
|
2012-02-21 18:22:43 +01:00
|
|
|
);
|
2009-06-07 20:59:43 +02:00
|
|
|
|
2012-06-23 21:15:59 +02:00
|
|
|
CREATE TABLE ACCESS_AUDITORY (
|
2013-03-18 03:19:29 +01:00
|
|
|
id INTEGER NOT NULL IDENTITY,
|
|
|
|
user_id INTEGER NOT NULL,
|
2014-01-30 02:15:26 +01:00
|
|
|
login_date DATE,
|
|
|
|
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
2012-06-23 21:15:59 +02:00
|
|
|
);
|
|
|
|
|
2013-03-14 22:51:17 +01:00
|
|
|
COMMIT;
|