adding directory table to sql scripts

This commit is contained in:
Ezequiel Bergamaschi 2014-01-19 23:46:02 -03:00 committed by Ezequiel Bergamaschi
parent 871d89a304
commit c0b8eb7176
4 changed files with 53 additions and 4 deletions

View File

@ -28,10 +28,19 @@ CREATE TABLE MINDMAP (
edition_date DATETIME, edition_date DATETIME,
creator_id INTEGER NOT NULL, creator_id INTEGER NOT NULL,
tags VARCHAR(1014), tags VARCHAR(1014),
last_editor_id INTEGER NOT NULL last_editor_id INTEGER NOT NULL,
directory_id INTEGER NOT NULL,
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
); );
CREATE TABLE DIRECTORY (
id INTEGER NOT NULL IDENTITY,
name VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
creator_id INTEGER NOT NULL,
--FOREIGN KEY (creator_id) REFERENCES USER (colaborator_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

@ -28,6 +28,19 @@ CREATE TABLE USER (
) )
CHARACTER SET utf8; CHARACTER SET utf8;
CREATE TABLE DIRECTORY (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
description VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
creator_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 ( CREATE TABLE MINDMAP (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) title VARCHAR(255)
@ -42,7 +55,9 @@ CREATE TABLE MINDMAP (
tags VARCHAR(1014) tags VARCHAR(1014)
CHARACTER SET utf8, CHARACTER SET utf8,
last_editor_id INTEGER NOT NULL, last_editor_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) directory_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
FOREIGN KEY (directory_id) REFERENCES DIRECTORY (id)
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE NO ACTION ON UPDATE NO ACTION
) )

View File

@ -3,3 +3,19 @@ AFTER `colaborator_id`;
ALTER TABLE `USER` ADD COLUMN `authenticator_uri` VARCHAR(255) CHARACTER SET utf8 ALTER TABLE `USER` ADD COLUMN `authenticator_uri` VARCHAR(255) CHARACTER SET utf8
AFTER `authentication_type`; AFTER `authentication_type`;
CREATE TABLE DIRECTORY (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
description VARCHAR(255)
CHARACTER SET utf8 NOT NULL,
creator_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
)
CHARACTER SET utf8;
ALTER TABLE `MINDMAP` ADD COLUMN `directory_id` INTEGER NOT NULL DEFAULT '/'
AFTER `last_editor_id`

View File

@ -30,10 +30,19 @@ CREATE TABLE MINDMAP (
edition_date TIMESTAMP, edition_date TIMESTAMP,
creator_id INTEGER NOT NULL, creator_id INTEGER NOT NULL,
tags VARCHAR(1014), tags VARCHAR(1014),
last_editor_id INTEGER NOT NULL --, last_editor_id INTEGER NOT NULL,
directory_id INTEGER NOT NULL--,
--FOREIGN KEY(creator_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION --FOREIGN KEY(creator_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
); );
CREATE TABLE DIRECTORY (
id SERIAL NOT NULL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
creator_id INTEGER NOT NULL,
--FOREIGN KEY(creator_id) REFERENCES "USER"(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
);
CREATE TABLE MINDMAP_HISTORY CREATE TABLE MINDMAP_HISTORY
(id SERIAL NOT NULL PRIMARY KEY, (id SERIAL NOT NULL PRIMARY KEY,