Fix SQL data initialization

This commit is contained in:
Paulo Gustavo Veiga 2024-01-21 22:02:58 -08:00
parent f0bc9e53ea
commit a3022d36d2
2 changed files with 2 additions and 2 deletions

View File

@ -1 +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,authentication_type) VALUES (1, 'Test', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURDATE(), 1,'D'); 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,authentication_type) VALUES (2, 'Admin', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURDATE(), 1,'D'); COMMIT; SHUTDOWN;
SET DATABASE SQL SYNTAX MYS TRUE; INSERT INTO COLLABORATOR (id, email, creation_date) VALUES (1, 'test@wisemapping.org', CURDATE()); INSERT IGNORE INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email,authentication_type) VALUES (1, 'Test', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURDATE(), 1,'D'); 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,authentication_type) INSERT IGNORE INTO USER (colaborator_id, firstname, lastname, password, activation_code, activation_date, allow_send_email,authentication_type) VALUES (2, 'Admin', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURDATE(), 1,'D');

View File

@ -1 +1 @@
CREATE TABLE COLLABORATOR ( id INTEGER NOT NULL IDENTITY, email VARCHAR(255) NOT NULL UNIQUE, creation_date DATE ); CREATE TABLE USER ( colaborator_id INTEGER NOT NULL IDENTITY, 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), google_sync BOOLEAN, sync_code VARCHAR(255), google_token VARCHAR(255), FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ); CREATE TABLE MINDMAP ( id INTEGER NOT NULL IDENTITY, title VARCHAR(255) NOT NULL, description VARCHAR(255), xml LONGVARBINARY NOT NULL, public BOOLEAN NOT NULL, creation_date DATETIME, edition_date DATETIME, creator_id INTEGER NOT NULL, last_editor_id INTEGER NOT NULL --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ); CREATE TABLE LABEL ( id INTEGER NOT NULL PRIMARY KEY IDENTITY, title VARCHAR(30), creator_id INTEGER NOT NULL, parent_label_id INTEGER, color VARCHAR(7) NOT NULL, --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ); 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) ON DELETE CASCADE ON UPDATE NO ACTION ); creation_date DATE CREATE TABLE USER ( 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) ); ); colaborator_id INTEGER NOT NULL IDENTITY, 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 ACCESS_AUDITORY ( id INTEGER NOT NULL IDENTITY, user_id INTEGER NOT NULL, login_date DATE, FOREIGN KEY (user_id) REFERENCES USER (colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION ); COMMIT;
CREATE TABLE IF NOT EXISTS COLLABORATOR ( id INTEGER NOT NULL IDENTITY, email VARCHAR(255) NOT NULL UNIQUE, creation_date DATE ); CREATE TABLE USER ( ); colaborator_id INTEGER NOT NULL IDENTITY, 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), google_sync BOOLEAN, sync_code VARCHAR(255), google_token VARCHAR(255), FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ); CREATE TABLE IF NOT EXISTS MINDMAP ( id INTEGER NOT NULL IDENTITY, title VARCHAR(255) NOT NULL, description VARCHAR(255), xml LONGVARBINARY NOT NULL, public BOOLEAN NOT NULL, creation_date DATETIME, edition_date DATETIME, creator_id INTEGER NOT NULL, last_editor_id INTEGER NOT NULL --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ); CREATE TABLE IF NOT EXISTS LABEL ( id INTEGER NOT NULL PRIMARY KEY IDENTITY, title VARCHAR(30), creator_id INTEGER NOT NULL, parent_label_id INTEGER, color VARCHAR(7) NOT NULL, --FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ); CREATE TABLE IF NOT EXISTS 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) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE USER ( authentication_type CHAR(1) NOT NULL, 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 IF NOT EXISTS COLLABORATION_PROPERTIES ( id INTEGER NOT NULL IDENTITY, starred BOOLEAN NOT NULL, mindmap_properties VARCHAR(512) ); colaborator_id INTEGER NOT NULL IDENTITY, COLLABORATOR ( 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 IF NOT EXISTS ACCESS_AUDITORY ( id INTEGER NOT NULL IDENTITY, user_id INTEGER NOT NULL, login_date DATE, FOREIGN KEY (user_id) REFERENCES USER (colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION );