2014-01-25 18:24:53 -03:00
|
|
|
#
|
|
|
|
# Command: mysql -u root -p < create_schemas.sql
|
|
|
|
#
|
|
|
|
|
2014-01-19 12:32:50 -03:00
|
|
|
USE wisemapping;
|
|
|
|
|
2012-06-22 01:34:33 -03:00
|
|
|
CREATE TABLE COLLABORATOR (
|
2013-03-17 23:19:29 -03:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
email VARCHAR(255)
|
|
|
|
CHARACTER SET utf8 NOT NULL UNIQUE,
|
|
|
|
creation_date DATE
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
|
|
|
CREATE TABLE USER (
|
2014-01-29 22:15:26 -03:00
|
|
|
colaborator_id INTEGER NOT NULL PRIMARY KEY,
|
2013-03-17 23:19:29 -03:00
|
|
|
authentication_type CHAR(1)
|
|
|
|
CHARACTER SET utf8 NOT NULL,
|
|
|
|
authenticator_uri VARCHAR(255)
|
|
|
|
CHARACTER SET utf8,
|
|
|
|
firstname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
|
|
|
|
lastname VARCHAR(255) CHARACTER SET utf8 NOT NULL,
|
|
|
|
password VARCHAR(255) CHARACTER SET utf8 NOT NULL,
|
|
|
|
activation_code BIGINT(20) NOT NULL,
|
|
|
|
activation_date DATE,
|
|
|
|
allow_send_email CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 0,
|
|
|
|
locale VARCHAR(5),
|
|
|
|
FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
|
|
|
CREATE TABLE MINDMAP (
|
2013-03-17 23:19:29 -03:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
title VARCHAR(255)
|
|
|
|
CHARACTER SET utf8 NOT NULL,
|
|
|
|
description VARCHAR(255)
|
|
|
|
CHARACTER SET utf8 NOT NULL,
|
|
|
|
xml MEDIUMBLOB NOT NULL,
|
|
|
|
public BOOL NOT NULL DEFAULT 0,
|
|
|
|
creation_date DATETIME,
|
|
|
|
edition_date DATETIME,
|
|
|
|
creator_id INTEGER NOT NULL,
|
|
|
|
tags VARCHAR(1014)
|
|
|
|
CHARACTER SET utf8,
|
|
|
|
last_editor_id INTEGER NOT NULL,
|
2014-01-21 01:46:04 -03:00
|
|
|
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
|
2013-03-17 23:19:29 -03:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2014-01-25 23:07:18 -03:00
|
|
|
CREATE TABLE LABEL (
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2014-01-28 00:13:29 -03:00
|
|
|
title VARCHAR(30)
|
2014-01-25 23:07:18 -03:00
|
|
|
CHARACTER SET utf8 NOT NULL,
|
|
|
|
creator_id INTEGER NOT NULL,
|
|
|
|
parent_label_id INTEGER,
|
2014-01-28 00:13:29 -03:00
|
|
|
color VARCHAR(7) NOT NULL,
|
2014-01-25 23:07:18 -03:00
|
|
|
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)
|
2014-02-01 18:53:54 -03:00
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
2014-01-25 23:07:18 -03:00
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2012-05-29 22:36:32 -03:00
|
|
|
|
|
|
|
CREATE TABLE MINDMAP_HISTORY
|
2013-03-17 23:19:29 -03:00
|
|
|
(id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
xml MEDIUMBLOB NOT NULL,
|
|
|
|
mindmap_id INTEGER NOT NULL,
|
|
|
|
creation_date DATETIME,
|
|
|
|
editor_id INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2013-03-17 23:19:29 -03:00
|
|
|
CREATE TABLE COLLABORATION_PROPERTIES (
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
starred BOOL NOT NULL DEFAULT 0,
|
|
|
|
mindmap_properties VARCHAR(512)
|
|
|
|
CHARACTER SET utf8
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2012-06-09 22:55:55 -03:00
|
|
|
|
|
|
|
CREATE TABLE COLLABORATION (
|
2013-03-17 23:19:29 -03:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
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)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2013-03-17 23:19:29 -03:00
|
|
|
CREATE TABLE TAG (
|
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
name VARCHAR(255)
|
|
|
|
CHARACTER SET utf8 NOT NULL,
|
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2012-06-23 16:15:59 -03:00
|
|
|
CREATE TABLE ACCESS_AUDITORY (
|
2013-03-17 23:19:29 -03:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
|
|
login_date DATE,
|
2014-01-29 22:15:26 -03:00
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
2013-03-17 23:19:29 -03:00
|
|
|
)
|
|
|
|
CHARACTER SET utf8;
|
2012-06-23 16:15:59 -03:00
|
|
|
|
2009-06-07 18:59:43 +00:00
|
|
|
COMMIT;
|