Skip to content

Commit

Permalink
provide setup db script
Browse files Browse the repository at this point in the history
  • Loading branch information
KochTobi committed Apr 8, 2024
1 parent 7c025d1 commit a206da0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
USE data_management;
CREATE TABLE `ngs_measurements`
(
`measurement_id` varchar(255) NOT NULL,
`measurementCode` varchar(255) DEFAULT NULL,
`projectId` varchar(255) DEFAULT NULL,
PRIMARY KEY (`measurement_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

CREATE TABLE `personal_access_tokens`
(
`id` int(11) NOT NULL,
`tokenValueEncrypted` varchar(255) DEFAULT NULL,
`creationDate` datetime(6) DEFAULT NULL,
`duration` decimal(21, 0) DEFAULT NULL,
`userId` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

CREATE TABLE `proteomics_measurement`
(
`measurement_id` varchar(255) NOT NULL,
`measurementCode` varchar(255) DEFAULT NULL,
`projectId` varchar(255) DEFAULT NULL,
PRIMARY KEY (`measurement_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

CREATE TABLE `roles`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`description` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

CREATE TABLE `users`
(
`id` varchar(255) NOT NULL,
`active` bit(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

CREATE TABLE `user_role`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`roleId` bigint(20) NOT NULL,
`userId` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_userId` (`userId`),
KEY `FK_roleId` (`roleId`),
CONSTRAINT `FK_roleId` FOREIGN KEY (`roleId`) REFERENCES `roles` (`id`),
CONSTRAINT `FK_userId` FOREIGN KEY (`userId`) REFERENCES `users` (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
4 changes: 4 additions & 0 deletions rest-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ logging.level.org.hibernate=error
logging.file.path=${LOG_PATH:./logs}
logging.file.name=${logging.file.path}/${LOG_FILE_NAME:server.log}

# set to true to enable ddl changes in the database
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=none

### Default datasource
spring.datasource.url=${USER_DB_URL:localhost}
spring.datasource.driver-class-name=${USER_DB_DRIVER:com.mysql.cj.jdbc.Driver}
Expand Down

0 comments on commit a206da0

Please sign in to comment.