Move database configuration scripts.

This commit is contained in:
Paulo Gustavo Veiga
2013-03-10 19:05:33 -03:00
parent 52efdf729b
commit 0e5592a0d3
13 changed files with 13 additions and 41 deletions

View File

@@ -83,6 +83,12 @@
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-openid</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
@@ -343,50 +349,19 @@
<executions>
<execution>
<id>drop-schemas</id>
<phase>test</phase>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<onError>continue</onError>
<orderFile>ascending</orderFile>
<orderFile>descending</orderFile>
<fileset>
<basedir>${project.basedir}</basedir>
<includes>
<include>src/test/sql/hsql/drop-schemas.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${project.basedir}</basedir>
<includes>
<include>src/test/sql/hsql/create-schemas.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>create-data</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${project.basedir}</basedir>
<includes>
<include>src/test/sql/hsql/test-data.sql</include>
<include>config/database/hsql/drop-schemas.sql</include>
<include>config/database/hsql/create-schemas.sql</include>
<include>config/database/hsql/test-data.sql</include>
</includes>
</fileset>
</configuration>
@@ -410,8 +385,6 @@
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>

View File

@@ -1,73 +0,0 @@
CREATE TABLE COLLABORATOR (
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,
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
--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));
CREATE TABLE COLLABORATION_PROPERTIES
(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)
);
CREATE TABLE TAG
(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
);
COMMIT;
SHUTDOWN;

View File

@@ -1,10 +0,0 @@
DROP TABLE ACCESS_AUDITORY;
DROP TABLE TAG;
DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP;
DROP TABLE USER;
DROP TABLE COLLABORATOR;
COMMIT;
SHUTDOWN;

View File

@@ -1,11 +0,0 @@
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);
COMMIT;
SHUTDOWN;

View File

@@ -1,3 +0,0 @@
CREATE DATABASE wisemapping CHARACTER SET='utf8' COLLATE='utf8_unicode_ci';
CREATE USER 'wisemapping'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON wisemapping.* TO 'wisemapping'@'localhost';

View File

@@ -1,74 +0,0 @@
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;
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 ;
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 ;
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 ;
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 ;
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 ;
COMMIT;

View File

@@ -1,9 +0,0 @@
DROP TABLE TAG;
DROP TABLE ACCESS_AUDITORY;
DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP;
DROP TABLE USER;
DROP TABLE COLLABORATOR;
COMMIT;

View File

@@ -1,10 +0,0 @@
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);
COMMIT;

View File

@@ -1,50 +0,0 @@
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`;
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) ;
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 ;
#ALTER TABLE ACCESS_AUDITORY
# ADD CONSTRAINT `user_id`
# FOREIGN KEY ()
# REFERENCES `USER` ()
# ON DELETE CASCADE
# 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 `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 `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;
DROP TABLE FEEDBACK;
ALTER TABLE `MINDMAP` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL;
ALTER TABLE `MINDMAP_HISTORY` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL;

View File

@@ -1,3 +0,0 @@
CREATE DATABASE wisemapping;
CREATE USER wisemapping WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE wisemapping TO wisemapping;

View File

@@ -1,78 +0,0 @@
CREATE TABLE COLLABORATOR (
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
) ;
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 --,
--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
) ;
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
) ;
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
) ;
COMMIT;

View File

@@ -1,9 +0,0 @@
DROP TABLE TAG;
DROP TABLE ACCESS_AUDITORY;
DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP;
DROP TABLE "user";
DROP TABLE COLLABORATOR;
COMMIT;