From 67398fe07e255090d3cb5cbc0326301ab4639ea7 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 17 Mar 2013 23:19:29 -0300 Subject: [PATCH] Add OpenId required colums. --- config/database/hsql/atest-data.sql | 12 +- config/database/hsql/create-schemas.sql | 95 ++++++------- config/database/mysql/create-database.sql | 7 +- config/database/mysql/create-schemas.sql | 146 ++++++++++++-------- config/database/mysql/test-data.sql | 12 +- config/database/mysql/v2.0-to-v3.0.sql | 48 ++++--- config/database/postgres/create-schemas.sql | 110 +++++++-------- 7 files changed, 237 insertions(+), 193 deletions(-) diff --git a/config/database/hsql/atest-data.sql b/config/database/hsql/atest-data.sql index 33373775..64648ea2 100644 --- a/config/database/hsql/atest-data.sql +++ b/config/database/hsql/atest-data.sql @@ -1,10 +1,10 @@ -INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE()); -INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email) -values(1,'Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1); +INSERT INTO COLLABORATOR (id, email, creation_date) VALUES (1, 'test@wisemapping.org', CURDATE()); +INSERT INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email) + VALUES (1, 'Test', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURDATE(), 1); -INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE()); -INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email) -values(2,'Admin','User', 'admin',1237,CURDATE(),1); +INSERT INTO COLLABORATOR (id, email, creation_date) VALUES (2, 'admin@wisemapping.org', CURDATE()); +INSERT INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email) + VALUES (2, 'Admin', 'User', 'admin', 1237, CURDATE(), 1); COMMIT; diff --git a/config/database/hsql/create-schemas.sql b/config/database/hsql/create-schemas.sql index 6061afc1..69bf4c0e 100644 --- a/config/database/hsql/create-schemas.sql +++ b/config/database/hsql/create-schemas.sql @@ -1,73 +1,74 @@ CREATE TABLE COLLABORATOR ( -id INTEGER NOT NULL IDENTITY, -email varchar(255) NOT NULL, -creation_date date); + id INTEGER NOT NULL IDENTITY, + email VARCHAR(255) NOT NULL, + creation_date DATE); CREATE TABLE USER ( -id INTEGER NOT NULL IDENTITY, -colaborator_id INTEGER NOT NULL, -auth_schema CHAR(1) NOT 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) + id INTEGER NOT NULL IDENTITY, + colaborator_id INTEGER NOT NULL, + 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) ); CREATE TABLE MINDMAP ( -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, -tags varchar(1014) , -last_editor_id INTEGER NOT NULL + 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, + tags VARCHAR(1014), + last_editor_id INTEGER NOT NULL --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ); 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)); +(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)); CREATE TABLE COLLABORATION_PROPERTIES -(id INTEGER NOT NULL IDENTITY, -starred BOOLEAN NOT NULL, -mindmap_properties varchar(512) +(id INTEGER NOT NULL IDENTITY, + starred BOOLEAN NOT NULL, + mindmap_properties VARCHAR(512) ); CREATE TABLE COLLABORATION -(id INTEGER NOT NULL IDENTITY, -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) +(id INTEGER NOT NULL IDENTITY, + 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) ); CREATE TABLE TAG -(id INTEGER NOT NULL IDENTITY, -name varchar(255) NOT NULL, -user_id INTEGER NOT NULL, +(id INTEGER NOT NULL IDENTITY, + name VARCHAR(255) NOT NULL, + user_id INTEGER NOT NULL, --FOREIGN KEY(user_id) REFERENCES USER(colaborator_id) ); CREATE TABLE ACCESS_AUDITORY ( -id INTEGER NOT NULL IDENTITY, -user_id INTEGER NOT NULL, -login_date date + id INTEGER NOT NULL IDENTITY, + user_id INTEGER NOT NULL, + login_date DATE ); COMMIT; diff --git a/config/database/mysql/create-database.sql b/config/database/mysql/create-database.sql index 7416a434..32203224 100644 --- a/config/database/mysql/create-database.sql +++ b/config/database/mysql/create-database.sql @@ -1,3 +1,6 @@ -CREATE DATABASE wisemapping CHARACTER SET='utf8' COLLATE='utf8_unicode_ci'; -CREATE USER 'wisemapping'@'localhost' IDENTIFIED BY 'password'; +CREATE DATABASE wisemapping + CHARACTER SET = 'utf8' + COLLATE = 'utf8_unicode_ci'; +CREATE USER 'wisemapping'@'localhost' + IDENTIFIED BY 'password'; GRANT ALL ON wisemapping.* TO 'wisemapping'@'localhost'; diff --git a/config/database/mysql/create-schemas.sql b/config/database/mysql/create-schemas.sql index fe110b06..97e62c74 100644 --- a/config/database/mysql/create-schemas.sql +++ b/config/database/mysql/create-schemas.sql @@ -1,74 +1,104 @@ CREATE TABLE COLLABORATOR ( -id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, -email varchar(255) CHARACTER SET utf8 NOT NULL UNIQUE, -creation_date date -) CHARACTER SET utf8; + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + email VARCHAR(255) + CHARACTER SET utf8 NOT NULL UNIQUE, + creation_date DATE +) + CHARACTER SET utf8; CREATE TABLE USER ( -id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, -colaborator_id INTEGER NOT NULL, -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 ; + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + colaborator_id INTEGER NOT NULL, + 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; CREATE TABLE MINDMAP ( -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, -FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION -) CHARACTER SET utf8 ; + 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, + FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) + ON DELETE CASCADE + ON UPDATE NO ACTION +) + CHARACTER SET utf8; CREATE TABLE MINDMAP_HISTORY -(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 ; +(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; -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; +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; CREATE TABLE COLLABORATION ( -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 ; + 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; -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 ; +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; CREATE TABLE ACCESS_AUDITORY ( -id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, -login_date date, -user_id INTEGER NOT NULL -) CHARACTER SET utf8 ; + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + login_date DATE, + user_id INTEGER NOT NULL +) + CHARACTER SET utf8; COMMIT; \ No newline at end of file diff --git a/config/database/mysql/test-data.sql b/config/database/mysql/test-data.sql index f55217f0..8e6b1b7b 100644 --- a/config/database/mysql/test-data.sql +++ b/config/database/mysql/test-data.sql @@ -1,10 +1,10 @@ -INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE()); -INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email) -values(1,'Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1); +INSERT INTO COLLABORATOR (id, email, creation_date) VALUES (1, 'test@wisemapping.org', CURRENT_DATE()); +INSERT INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email) + VALUES (1, 'Test', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURRENT_DATE(), 1); -INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURRENT_DATE()); -INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email) -values(2,'Admin','User', 'admin',1237,CURRENT_DATE(),1); +INSERT INTO COLLABORATOR (id, email, creation_date) VALUES (2, 'admin@wisemapping.org', CURRENT_DATE()); +INSERT INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email) + VALUES (2, 'Admin', 'User', 'admin', 1237, CURRENT_DATE(), 1); COMMIT; diff --git a/config/database/mysql/v2.0-to-v3.0.sql b/config/database/mysql/v2.0-to-v3.0.sql index 8bfef8c7..fb4fca28 100644 --- a/config/database/mysql/v2.0-to-v3.0.sql +++ b/config/database/mysql/v2.0-to-v3.0.sql @@ -1,27 +1,31 @@ -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; +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; -drop table `MINDMAP_NATIVE`; -ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`; -ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`; +DROP TABLE `MINDMAP_NATIVE`; +ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`; +ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`; -ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ; +ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties`, DROP COLUMN `mindMapNative_id`; ALTER TABLE `MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL , DROP INDEX `owner_id` -, ADD INDEX `owner_id` (`creator_id` ASC) ; +, ADD INDEX `owner_id` (`creator_id` ASC); -ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ; +ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL +AFTER `role_id`; DROP TABLE USER_LOGIN; CREATE TABLE ACCESS_AUDITORY ( -id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, -user_id INTEGER NOT NULL, -login_date date -) CHARACTER SET utf8 ; + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + user_id INTEGER NOT NULL, + login_date DATE +) + CHARACTER SET utf8; #ALTER TABLE ACCESS_AUDITORY # ADD CONSTRAINT `user_id` @@ -31,18 +35,22 @@ login_date date # ON UPDATE NO ACTION #, ADD INDEX `user_id` () ; -ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`; +ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user`, ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL +AFTER `creation_date`; -ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ; +ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL +AFTER `allowSendEmail`; -ALTER TABLE `MINDMAP` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2 AFTER `tags` ; +ALTER TABLE `MINDMAP` DROP COLUMN `last_editor`, ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2 +AFTER `tags`; -ALTER TABLE `USER` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ; +ALTER TABLE `USER` DROP COLUMN `username`, CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL, CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0'; INSERT INTO `MINDMAP` (`last_editor_id`) VALUES (1); INSERT INTO `COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wis.com', '2007-10-09'); -DELETE FROM `USER` where activation_date is null; +DELETE FROM `USER` +WHERE activation_date IS null; DROP TABLE FEEDBACK; diff --git a/config/database/postgres/create-schemas.sql b/config/database/postgres/create-schemas.sql index df02023f..164c2058 100644 --- a/config/database/postgres/create-schemas.sql +++ b/config/database/postgres/create-schemas.sql @@ -1,78 +1,80 @@ CREATE TABLE COLLABORATOR ( -id SERIAL NOT NULL PRIMARY KEY, -email varchar(255) NOT NULL UNIQUE, -creation_date date + id SERIAL NOT NULL PRIMARY KEY, + email VARCHAR(255) NOT NULL UNIQUE, + creation_date DATE ); CREATE TABLE "user" ( -id SERIAL NOT NULL PRIMARY KEY, -colaborator_id INTEGER NOT 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 text NOT NULL default 0, -locale varchar(5), -FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id) ON DELETE CASCADE ON UPDATE NO ACTION -) ; + id SERIAL NOT NULL PRIMARY KEY, + authentication_type TEXT NOT NULL, + authenticator_uri VARCHAR(255) NOT NULL, + colaborator_id INTEGER NOT 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 TEXT NOT NULL DEFAULT 0, + locale VARCHAR(5), + FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ON DELETE CASCADE ON UPDATE NO ACTION +); CREATE TABLE MINDMAP ( -id SERIAL NOT NULL PRIMARY KEY, -title varchar(255) NOT NULL, -description varchar(255) NOT NULL, -xml bytea NOT NULL, -public BOOL not null default FALSE, -creation_date timestamp, -edition_date timestamp, -creator_id INTEGER not null, -tags varchar(1014) , -last_editor_id INTEGER NOT NULL --, + id SERIAL NOT NULL PRIMARY KEY, + title VARCHAR(255) NOT NULL, + description VARCHAR(255) NOT NULL, + xml BYTEA NOT NULL, + public BOOL NOT NULL DEFAULT FALSE, + creation_date TIMESTAMP, + edition_date TIMESTAMP, + creator_id INTEGER NOT NULL, + tags VARCHAR(1014), + last_editor_id INTEGER NOT NULL --, --FOREIGN KEY(creator_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION -) ; +); CREATE TABLE MINDMAP_HISTORY -(id SERIAL NOT NULL PRIMARY KEY, -xml bytea NOT NULL, -mindmap_id INTEGER NOT NULL, -creation_date timestamp, -editor_id INTEGER NOT NULL, -FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id) ON DELETE CASCADE ON UPDATE NO ACTION -) ; +(id SERIAL NOT NULL PRIMARY KEY, + xml BYTEA NOT NULL, + mindmap_id INTEGER NOT NULL, + creation_date TIMESTAMP, + editor_id INTEGER NOT NULL, + FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id) ON DELETE CASCADE ON UPDATE NO ACTION +); -CREATE TABLE COLLABORATION_PROPERTIES( -id SERIAL NOT NULL PRIMARY KEY, -starred BOOL NOT NULL default FALSE, -mindmap_properties varchar(512) +CREATE TABLE COLLABORATION_PROPERTIES ( + id SERIAL NOT NULL PRIMARY KEY, + starred BOOL NOT NULL DEFAULT FALSE, + mindmap_properties VARCHAR(512) ); CREATE TABLE COLLABORATION ( -id SERIAL NOT NULL PRIMARY KEY, -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 -) ; + id SERIAL NOT NULL PRIMARY KEY, + 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 +); -CREATE TABLE TAG( -id SERIAL NOT NULL PRIMARY KEY, -name varchar(255) NOT NULL, -user_id INTEGER NOT NULL --, +CREATE TABLE TAG ( + id SERIAL NOT NULL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + user_id INTEGER NOT NULL --, --FOREIGN KEY(user_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION -) ; +); CREATE TABLE ACCESS_AUDITORY ( -id SERIAL NOT NULL PRIMARY KEY, -login_date date, -user_id INTEGER NOT NULL -) ; + id SERIAL NOT NULL PRIMARY KEY, + login_date DATE, + user_id INTEGER NOT NULL +); COMMIT;