- Add migration script

- Rename some tables
This commit is contained in:
Paulo Gustavo Veiga 2012-06-22 01:34:33 -03:00
parent 10e869ab70
commit 2d8fa5c259
9 changed files with 74 additions and 53 deletions

View File

@ -1,38 +1,38 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC <!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN" "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping> <hibernate-mapping>
<class name="com.wisemapping.model.Collaborator" table="COLABORATOR"> <class name="com.wisemapping.model.Collaborator" table="COLLABORATOR">
<id name="id"> <id name="id">
<generator class="increment"/> <generator class="increment"/>
</id> </id>
<property name="email"/> <property name="email"/>
<property name="creationDate" column="creation_date"/> <property name="creationDate" column="creation_date"/>
<set name="collaborations" <set name="collaborations"
cascade="all, delete-orphan" cascade="all, delete-orphan"
inverse="true"> inverse="true">
<key column="COLABORATOR_ID" not-null="true"/> <key column="COLABORATOR_ID" not-null="true"/>
<one-to-many class="com.wisemapping.model.Collaboration"/> <one-to-many class="com.wisemapping.model.Collaboration"/>
</set> </set>
<joined-subclass name="com.wisemapping.model.User" table="USER"> <joined-subclass name="com.wisemapping.model.User" table="USER">
<key column="COLABORATOR_ID"/> <key column="COLABORATOR_ID"/>
<property name="username" not-null="true"/> <property name="username" not-null="true"/>
<property name="firstname"/> <property name="firstname"/>
<property name="lastname"/> <property name="lastname"/>
<property name="password"/> <property name="password"/>
<property name="activationDate" column="activation_date"/> <property name="activationDate" column="activation_date"/>
<property name="activationCode"/> <property name="activationCode"/>
<property name="allowSendEmail"/> <property name="allowSendEmail"/>
<set name="tags" table="TAG"> <set name="tags" table="TAG">
<key column="user_id"/> <key column="user_id"/>
<element column="name" type="string"/> <element column="name" type="string"/>
</set> </set>
</joined-subclass> </joined-subclass>
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View File

@ -14,10 +14,12 @@
var iframeWindow = $('dialogContentIframe').contentWindow; var iframeWindow = $('dialogContentIframe').contentWindow;
var delay = iframeWindow.submitDialogForm(); var delay = iframeWindow.submitDialogForm();
if (MooDialog.Request.active && !delay) { if (MooDialog.Request.active) {
MooDialog.Request.active.close(); if (!delay) {
} else { MooDialog.Request.active.close();
MooDialog.Request.active.close.delay(3000,MooDialog.Request.active); } else {
MooDialog.Request.active.close.delay(3000, MooDialog.Request.active);
}
} }
}); });

View File

@ -1,4 +1,4 @@
CREATE TABLE COLABORATOR ( CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL IDENTITY, id INTEGER NOT NULL IDENTITY,
email varchar(255) NOT NULL, email varchar(255) NOT NULL,
creation_date date); creation_date date);
@ -13,7 +13,7 @@ password varchar(255) NOT NULL,
activationCode BIGINT NOT NULL, activationCode BIGINT NOT NULL,
activation_date DATE, activation_date DATE,
allowSendEmail CHAR(1) NOT NULL, allowSendEmail CHAR(1) NOT NULL,
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id) FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id)
); );
CREATE TABLE MINDMAP ( CREATE TABLE MINDMAP (
@ -49,7 +49,7 @@ colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL, properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL, mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL, role_id INTEGER NOT NULL,
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id), FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id),
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id), FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id),
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id) FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id)
); );

View File

@ -4,7 +4,7 @@ DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY; DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP; DROP TABLE MINDMAP;
DROP TABLE USER; DROP TABLE USER;
DROP TABLE COLABORATOR; DROP TABLE COLLABORATOR;
DROP TABLE USER_LOGIN; DROP TABLE USER_LOGIN;
COMMIT; COMMIT;
SHUTDOWN; SHUTDOWN;

View File

@ -1,8 +1,8 @@
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE()); INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1); values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
INSERT INTO COLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE()); INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
values(2,'wise-admin','Admin','User', 'admin',1237,CURDATE(),1); values(2,'wise-admin','Admin','User', 'admin',1237,CURDATE(),1);

View File

@ -1,4 +1,4 @@
CREATE TABLE COLABORATOR ( CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
email varchar(255) CHARACTER SET utf8 NOT NULL UNIQUE, email varchar(255) CHARACTER SET utf8 NOT NULL UNIQUE,
creation_date date creation_date date
@ -14,7 +14,7 @@ password varchar(255) CHARACTER SET utf8 NOT NULL,
activationCode BIGINT(20) NOT NULL, activationCode BIGINT(20) NOT NULL,
activation_date date, activation_date date,
allowSendEmail char(1) CHARACTER SET utf8 NOT NULL default 0, allowSendEmail char(1) CHARACTER SET utf8 NOT NULL default 0,
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id) FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id)
) CHARACTER SET utf8 ; ) CHARACTER SET utf8 ;
CREATE TABLE MINDMAP ( CREATE TABLE MINDMAP (
@ -52,7 +52,7 @@ colaborator_id INTEGER NOT NULL,
properties_id INTEGER NOT NULL, properties_id INTEGER NOT NULL,
mindmap_id INTEGER NOT NULL, mindmap_id INTEGER NOT NULL,
role_id INTEGER NOT NULL, role_id INTEGER NOT NULL,
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id), FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id),
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id) FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id), FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id),
) CHARACTER SET utf8 ; ) CHARACTER SET utf8 ;

View File

@ -4,6 +4,6 @@ DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY; DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP; DROP TABLE MINDMAP;
DROP TABLE USER; DROP TABLE USER;
DROP TABLE COLABORATOR; DROP TABLE COLLABORATOR;
DROP TABLE USER_LOGIN; DROP TABLE USER_LOGIN;
COMMIT; COMMIT;

View File

@ -1,8 +1,8 @@
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE()); INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1); values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1);
INSERT INTO COLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURRENT_DATE()); INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURRENT_DATE());
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail) INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
values(2,'wise-admin','Admin','User', 'admin',1237,CURRENT_DATE(),1); values(2,'wise-admin','Admin','User', 'admin',1237,CURRENT_DATE(),1);

View File

@ -0,0 +1,19 @@
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 `wisemapping`.`MINDMAP_NATIVE`
ALTER TABLE `wisemapping`.`mindmap_colaborator` RENAME TO `wisemapping`.`COLLABORATION` ;
ALTER TABLE `wisemapping`.`colaborator` RENAME TO `wisemapping`.`collaborator` ;
ALTER TABLE `wisemapping`.`mindmap` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ;
ALTER TABLE `wisemapping`.`mindmap` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
, DROP INDEX `owner_id`
, ADD INDEX `owner_id` (`creator_id` ASC) ;
ALTER TABLE `wisemapping`.`collaboration` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ;
#INSERT INTO `wisemapping`.`collaborator` (`id`, `email`, `creation_date`) VALUES (8081, 'fake@wisemapping.com', '2007-10-09');