diff --git a/config/database/mysql/apopulate-schemas.sql b/config/database/mysql/apopulate-schemas.sql deleted file mode 100644 index f5e38020..00000000 --- a/config/database/mysql/apopulate-schemas.sql +++ /dev/null @@ -1 +0,0 @@ -# # Command: mysql -u root -p < apopulate_schemas.sql # 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,authentication_type) VALUES (1, 'Test', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURRENT_DATE(), 1,'D'); 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,authentication_type) VALUES (2, 'Admin', 'User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1237, CURRENT_DATE(), 1,'D'); COMMIT; \ No newline at end of file diff --git a/config/database/mysql/app-mysql.yaml b/config/database/mysql/app-mysql.yaml new file mode 100644 index 00000000..be89a7db --- /dev/null +++ b/config/database/mysql/app-mysql.yaml @@ -0,0 +1,14 @@ + +spring: + datasource: + url: jdbc:mysql://localhost:3306/wisemapping?useUnicode=yes&characterEncoding=UTF-8 + driver-class-name: com.mysql.cj.jdbc.Driver + password: password + username: wisemapping + jpa: + properties: + hibernate: + dialect: org.hibernate.dialect.MySQLDialect + sql: + init: + platform: mysql \ No newline at end of file diff --git a/config/database/mysql/drop-schemas.sql b/config/database/mysql/drop-schemas.sql deleted file mode 100644 index 6be70e14..00000000 --- a/config/database/mysql/drop-schemas.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS ACCESS_AUDITORY; DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; DROP TABLE IF EXISTS MINDMAP_HISTORY; DROP TABLE IF EXISTS LABEL; DROP TABLE IF EXISTS MINDMAP; DROP TABLE IF EXISTS R_LABEL_MINDMAP DROP TABLE IF EXISTS USER; DROP TABLE IF EXISTS COLLABORATOR; COMMIT; \ No newline at end of file diff --git a/config/database/postgres/create-database.sql b/config/database/postgres/create-database.sql index 3a1305f2..8d231264 100644 --- a/config/database/postgres/create-database.sql +++ b/config/database/postgres/create-database.sql @@ -1,4 +1,7 @@ + CREATE DATABASE wisemapping; CREATE USER wisemapping WITH PASSWORD 'password'; +GRANT ALL PRIVILEGES ON DATABASE wisemapping TO wisemapping; -GRANT ALL PRIVILEGES ON DATABASE wisemapping TO wisemapping; \ No newline at end of file +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO wisemapping; +GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO wisemapping; diff --git a/config/database/postgres/drop-schemas.sql b/config/database/postgres/drop-schemas.sql deleted file mode 100644 index 6b49abbe..00000000 --- a/config/database/postgres/drop-schemas.sql +++ /dev/null @@ -1,10 +0,0 @@ -DROP TABLE IF EXISTS ACCESS_AUDITORY; -DROP TABLE IF EXISTS COLLABORATION; -DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; -DROP TABLE IF EXISTS MINDMAP_HISTORY; -DROP TABLE IF EXISTS R_LABEL_MINDMAP; -DROP TABLE IF EXISTS "LABEL"; -DROP TABLE IF EXISTS MINDMAP; -DROP TABLE IF EXISTS "USER"; -DROP TABLE IF EXISTS COLLABORATOR; -COMMIT; \ No newline at end of file diff --git a/wise-api/doc/Compile.md b/wise-api/doc/Compile.md deleted file mode 100644 index d0727845..00000000 --- a/wise-api/doc/Compile.md +++ /dev/null @@ -1,4 +0,0 @@ -# Compilation and Execution - -Your will find all the steps and required documentation here: http://www.wisemapping.org/downloads/source - diff --git a/wise-api/docker/compose.yaml b/wise-api/docker/compose.yaml deleted file mode 100644 index cea52055..00000000 --- a/wise-api/docker/compose.yaml +++ /dev/null @@ -1,9 +0,0 @@ -services: - database: - image: 'postgres:15.2' - ports: - - '5432' - environment: - - 'POSTGRES_USER=myuser' - - 'POSTGRES_DB=mydatabase' - - 'POSTGRES_PASSWORD=secret' \ No newline at end of file diff --git a/wise-api/src/main/resources/data-mysql.sql b/wise-api/src/main/resources/data-mysql.sql new file mode 100644 index 00000000..3ccef8a2 --- /dev/null +++ b/wise-api/src/main/resources/data-mysql.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO COLLABORATOR (id, email, creation_date) VALUES (1, 'test@wisemapping.org', CURRENT_DATE()); 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, CURRENT_DATE(), 1,'D'); INSERT IGNORE INTO COLLABORATOR (id, email, creation_date) VALUES (2, 'admin@wisemapping.org', CURRENT_DATE()); 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, CURRENT_DATE(), 1,'D'); \ No newline at end of file diff --git a/config/database/postgres/create-schemas.sql b/wise-api/src/main/resources/data-postgresql.sql similarity index 92% rename from config/database/postgres/create-schemas.sql rename to wise-api/src/main/resources/data-postgresql.sql index cbb930cd..88225b5b 100644 --- a/config/database/postgres/create-schemas.sql +++ b/wise-api/src/main/resources/data-postgresql.sql @@ -83,10 +83,4 @@ CREATE TABLE ACCESS_AUDITORY ( login_date DATE, user_id INTEGER NOT NULL, FOREIGN KEY (user_id) REFERENCES "USER" (colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION -); - - -GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO wisemapping; -GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO wisemapping; - -COMMIT; +); \ No newline at end of file diff --git a/config/database/mysql/create-schemas.sql b/wise-api/src/main/resources/schema-mysql.sql similarity index 68% rename from config/database/mysql/create-schemas.sql rename to wise-api/src/main/resources/schema-mysql.sql index 32f04c9c..27735a69 100644 --- a/config/database/mysql/create-schemas.sql +++ b/wise-api/src/main/resources/schema-mysql.sql @@ -1,29 +1,22 @@ -# -# Command: mysql -u root -p < create-schemas.sql -# - -USE wisemapping; - -CREATE TABLE COLLABORATOR ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - email VARCHAR(255) - CHARACTER SET utf8 NOT NULL UNIQUE, +CREATE TABLE IF NOT EXISTS COLLABORATOR ( + id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, + email VARCHAR(255) CHARACTER SET UTF8MB4 NOT NULL UNIQUE, creation_date DATE ) - CHARACTER SET utf8; +CHARACTER SET UTF8MB4; -CREATE TABLE USER ( +CREATE TABLE IF NOT EXISTS USER ( colaborator_id INTEGER NOT NULL PRIMARY KEY, authentication_type CHAR(1) - CHARACTER SET utf8 NOT NULL, + CHARACTER SET UTF8MB4 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, + firstname VARCHAR(255) CHARACTER SET UTF8MB4 NOT NULL, + lastname VARCHAR(255) CHARACTER SET UTF8MB4 NOT NULL, + password VARCHAR(255) CHARACTER SET UTF8MB4 NOT NULL, activation_code BIGINT(20) NOT NULL, activation_date DATE, - allow_send_email CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 0, + allow_send_email CHAR(1) CHARACTER SET UTF8MB4 NOT NULL DEFAULT 0, locale VARCHAR(5), google_sync BOOL, sync_code VARCHAR(255), @@ -31,15 +24,14 @@ CREATE TABLE USER ( FOREIGN KEY (colaborator_id) REFERENCES COLLABORATOR (id) ON DELETE CASCADE ON UPDATE NO ACTION -) - CHARACTER SET utf8; +) CHARACTER SET UTF8MB4; -CREATE TABLE MINDMAP ( +CREATE TABLE IF NOT EXISTS MINDMAP ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) - CHARACTER SET utf8 NOT NULL, + CHARACTER SET UTF8MB4 NOT NULL, description VARCHAR(255) - CHARACTER SET utf8 NOT NULL, + CHARACTER SET utf8, xml MEDIUMBLOB NOT NULL, public BOOL NOT NULL DEFAULT 0, creation_date DATETIME, @@ -50,12 +42,12 @@ CREATE TABLE MINDMAP ( ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; + CHARACTER SET UTF8MB4; -CREATE TABLE LABEL ( +CREATE TABLE IF NOT EXISTS LABEL ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(30) - CHARACTER SET utf8 NOT NULL, + CHARACTER SET UTF8MB4 NOT NULL, creator_id INTEGER NOT NULL, parent_label_id INTEGER, color VARCHAR(7) NOT NULL, @@ -64,9 +56,9 @@ CREATE TABLE LABEL ( ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; + CHARACTER SET UTF8MB4; -CREATE TABLE R_LABEL_MINDMAP ( +CREATE TABLE IF NOT EXISTS R_LABEL_MINDMAP ( mindmap_id INTEGER NOT NULL, label_id INTEGER NOT NULL, PRIMARY KEY (mindmap_id, label_id), @@ -75,9 +67,9 @@ CREATE TABLE R_LABEL_MINDMAP ( ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; + CHARACTER SET UTF8MB4; -CREATE TABLE MINDMAP_HISTORY +CREATE TABLE IF NOT EXISTS MINDMAP_HISTORY (id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, xml MEDIUMBLOB NOT NULL, mindmap_id INTEGER NOT NULL, @@ -87,17 +79,17 @@ CREATE TABLE MINDMAP_HISTORY ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; + CHARACTER SET UTF8MB4; -CREATE TABLE COLLABORATION_PROPERTIES ( +CREATE TABLE IF NOT EXISTS 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; + CHARACTER SET UTF8MB4; -CREATE TABLE COLLABORATION ( +CREATE TABLE IF NOT EXISTS COLLABORATION ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, colaborator_id INTEGER NOT NULL, properties_id INTEGER NOT NULL, @@ -112,9 +104,9 @@ CREATE TABLE COLLABORATION ( ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; + CHARACTER SET UTF8MB4; -CREATE TABLE ACCESS_AUDITORY ( +CREATE TABLE IF NOT EXISTS ACCESS_AUDITORY ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, login_date DATE, user_id INTEGER NOT NULL, @@ -122,6 +114,4 @@ CREATE TABLE ACCESS_AUDITORY ( ON DELETE CASCADE ON UPDATE NO ACTION ) - CHARACTER SET utf8; - -COMMIT; \ No newline at end of file +CHARACTER SET UTF8MB4; \ No newline at end of file