create demo version
This commit is contained in:
parent
2855f93a55
commit
1a8b1b4d34
13 changed files with 514 additions and 8 deletions
7
docker/demo/DOCKERFILE
Normal file
7
docker/demo/DOCKERFILE
Normal file
|
@ -0,0 +1,7 @@
|
|||
FROM java:openjdk-8
|
||||
|
||||
WORKDIR /demo
|
||||
|
||||
EXPOSE 8090
|
||||
|
||||
ENTRYPOINT ["java","-jar",".\seb-server-0.1.0-SNAPSHOT.jar","--spring.config.location=classpath:/config/,file:/externalResources/","--spring.profiles.active=dev"]
|
30
pom.xml
30
pom.xml
|
@ -26,6 +26,35 @@
|
|||
Java 11 (from eclipse and command-line) and one to build still on Java 8
|
||||
to support the Jenkins build on CI-Server that still no Java 11 installed -->
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>Demo</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>Java 11</id>
|
||||
<activation>
|
||||
|
@ -273,6 +302,7 @@
|
|||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -10,14 +10,13 @@ package ch.ethz.seb.sebserver;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@SpringBootApplication(exclude = {
|
||||
// OAuth2ResourceServerAutoConfiguration.class,
|
||||
UserDetailsServiceAutoConfiguration.class,
|
||||
DataSourceAutoConfiguration.class
|
||||
//DataSourceAutoConfiguration.class
|
||||
})
|
||||
@Configuration
|
||||
public class SEBServer {
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.apache.http.client.HttpClient;
|
|||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -60,6 +62,7 @@ import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile;
|
|||
@GuiProfile
|
||||
@RestController
|
||||
@Order(6)
|
||||
@Import(DataSourceAutoConfiguration.class)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements ErrorController {
|
||||
|
||||
@Value("${sebserver.webservice.api.redirect.unauthorized}")
|
||||
|
|
|
@ -21,6 +21,6 @@ import org.springframework.context.annotation.Profile;
|
|||
* and only for development and/or testing */
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Profile({ "dev-gui", "test" })
|
||||
@Profile({ "dev-gui", "test", "demo" })
|
||||
public @interface DevGuiProfile {
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ import org.springframework.context.annotation.Profile;
|
|||
* and only for development and/or testing */
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Profile({ "dev-ws", "test" })
|
||||
@Profile({ "dev-ws", "test", "demo" })
|
||||
public @interface DevWebServiceProfile {
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ import org.springframework.context.annotation.Profile;
|
|||
* but for all vertical profiles like dev, prod and test */
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Profile({ "dev-gui", "prod-gui" })
|
||||
@Profile({ "dev-gui", "prod-gui", "demo" })
|
||||
public @interface GuiProfile {
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ import org.springframework.context.annotation.Profile;
|
|||
* but for all vertical profiles like dev, prod and test */
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Profile({ "dev-ws", "prod-ws", "test" })
|
||||
@Profile({ "dev-ws", "prod-ws", "test", "demo" })
|
||||
public @interface WebServiceProfile {
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||
|
||||
@Autowired
|
||||
private AccessTokenConverter accessTokenConverter;
|
||||
@Autowired
|
||||
@Autowired(required = true)
|
||||
private DataSource dataSource;
|
||||
@Autowired
|
||||
private WebServiceUserDetails webServiceUserDetails;
|
||||
|
@ -74,6 +74,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||
|
||||
@Bean
|
||||
public TokenStore tokenStore() {
|
||||
System.out.println("************************* this.dataSource:" + this.dataSource);
|
||||
return new JdbcTokenStore(this.dataSource);
|
||||
}
|
||||
|
||||
|
|
33
src/main/resources/config/application-demo.properties
Normal file
33
src/main/resources/config/application-demo.properties
Normal file
|
@ -0,0 +1,33 @@
|
|||
server.address=localhost
|
||||
server.port=8090
|
||||
server.servlet.context-path=/
|
||||
|
||||
spring.h2.console.enabled=true
|
||||
spring.datasource.platform=h2
|
||||
spring.datasource.url=jdbc:h2:mem:demo;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
||||
spring.datasource.driver-class-name=org.h2.Driver
|
||||
spring.datasource.platform=demo
|
||||
|
||||
sebserver.webservice.api.admin.clientId=guiClient
|
||||
sebserver.webservice.api.admin.clientSecret=guiClient
|
||||
sebserver.webservice.api.admin.endpoint=/admin-api/v1
|
||||
sebserver.webservice.api.admin.accessTokenValiditySeconds=1800
|
||||
sebserver.webservice.api.admin.refreshTokenValiditySeconds=-1
|
||||
sebserver.webservice.api.exam.endpoint=/exam-api/v1
|
||||
sebserver.webservice.api.exam.accessTokenValiditySeconds=1800
|
||||
sebserver.webservice.api.exam.refreshTokenValiditySeconds=-1
|
||||
|
||||
sebserver.webservice.api.redirect.unauthorized=none
|
||||
|
||||
server.servlet.session.cookie.http-only=true
|
||||
server.servlet.session.tracking-modes=cookie
|
||||
|
||||
sebserver.gui.entrypoint=/gui
|
||||
sebserver.gui.webservice.protocol=http
|
||||
sebserver.gui.webservice.address=localhost
|
||||
sebserver.gui.webservice.port=8090
|
||||
sebserver.gui.webservice.apipath=/admin-api/v1
|
||||
|
||||
|
||||
sebserver.gui.theme=css/sebserver.css
|
||||
sebserver.gui.date.displayformat=EEEE, dd MMMM yyyy - HH:mm
|
|
@ -1,5 +1,5 @@
|
|||
spring.application.name=SEB Server
|
||||
spring.profiles.active=dev
|
||||
spring.profiles.active=demo
|
||||
|
||||
sebserver.version=1.0 beta
|
||||
|
||||
|
|
13
src/main/resources/data-demo.sql
Normal file
13
src/main/resources/data-demo.sql
Normal file
|
@ -0,0 +1,13 @@
|
|||
INSERT INTO institution VALUES
|
||||
(1, 'ETH Zürich', 'ethz', null, 1)
|
||||
;
|
||||
|
||||
INSERT INTO user VALUES
|
||||
(1, 1, 'internalDemoAdmin', 'Admin1', 'admin', '$2a$08$c2GKYEYoUVXH1Yb8GXVXVu66ltPvbZgLMcVSXRH.LgZNF/YeaYB8m', 'admin@nomail.nomail', 'en', 'UTC', 1)
|
||||
;
|
||||
|
||||
INSERT INTO user_role VALUES
|
||||
(1, 1, 'SEB_SERVER_ADMIN')
|
||||
;
|
||||
|
||||
|
420
src/main/resources/schema-demo.sql
Normal file
420
src/main/resources/schema-demo.sql
Normal file
|
@ -0,0 +1,420 @@
|
|||
|
||||
-- -----------------------------------------------------
|
||||
-- Schema SEBServerDemo
|
||||
-- -----------------------------------------------------
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `institution`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `institution` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `institution` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`url_suffix` VARCHAR(45) NULL,
|
||||
`logo_image` MEDIUMTEXT NULL,
|
||||
`active` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `name_UNIQUE` (`name` ASC))
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `lms_setup`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `lms_setup` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `lms_setup` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`institution_id` BIGINT UNSIGNED NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`lms_type` VARCHAR(45) NOT NULL,
|
||||
`lms_url` VARCHAR(255) NULL,
|
||||
`lms_clientname` VARCHAR(255) NOT NULL,
|
||||
`lms_clientsecret` VARCHAR(255) NOT NULL,
|
||||
`lms_rest_api_token` VARCHAR(4000) NULL,
|
||||
`seb_clientname` VARCHAR(255) NOT NULL,
|
||||
`seb_clientsecret` VARCHAR(255) NOT NULL,
|
||||
`active` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `setupInstitutionRef_idx` (`institution_id` ASC),
|
||||
CONSTRAINT `setupInstitutionRef`
|
||||
FOREIGN KEY (`institution_id`)
|
||||
REFERENCES `institution` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `exam`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `exam` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `exam` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`institution_id` BIGINT UNSIGNED NOT NULL,
|
||||
`lms_setup_id` BIGINT UNSIGNED NOT NULL,
|
||||
`external_id` VARCHAR(255) NOT NULL,
|
||||
`owner` VARCHAR(255) NOT NULL,
|
||||
`supporter` VARCHAR(4000) NULL COMMENT 'comma separated list of user_uuid',
|
||||
`type` VARCHAR(45) NOT NULL,
|
||||
`status` VARCHAR(45) NOT NULL,
|
||||
`quit_password` VARCHAR(255) NULL,
|
||||
`active` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `lms_setup_key_idx` (`lms_setup_id` ASC),
|
||||
INDEX `institution_key_idx` (`institution_id` ASC),
|
||||
CONSTRAINT `examLmsSetupRef`
|
||||
FOREIGN KEY (`lms_setup_id`)
|
||||
REFERENCES `lms_setup` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `examInstitutionRef`
|
||||
FOREIGN KEY (`institution_id`)
|
||||
REFERENCES `institution` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `client_connection`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `client_connection` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `client_connection` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`exam_id` BIGINT UNSIGNED NULL,
|
||||
`status` VARCHAR(45) NOT NULL,
|
||||
`connection_token` VARCHAR(255) NOT NULL,
|
||||
`user_name` VARCHAR(255) NOT NULL,
|
||||
`VDI` BIT(1) NOT NULL,
|
||||
`client_address` VARCHAR(45) NOT NULL,
|
||||
`virtual_client_address` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `connection_exam_ref_idx` (`exam_id` ASC),
|
||||
CONSTRAINT `clientConnectionExamRef`
|
||||
FOREIGN KEY (`exam_id`)
|
||||
REFERENCES `exam` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `client_event`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `client_event` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `client_event` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`connection_id` BIGINT UNSIGNED NOT NULL,
|
||||
`user_identifier` VARCHAR(255) NOT NULL,
|
||||
`type` INT(2) UNSIGNED NOT NULL,
|
||||
`timestamp` BIGINT UNSIGNED NOT NULL,
|
||||
`numeric_value` DECIMAL(10,4) NULL,
|
||||
`text` VARCHAR(255) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `eventConnectionRef_idx` (`connection_id` ASC),
|
||||
CONSTRAINT `eventConnectionRef`
|
||||
FOREIGN KEY (`connection_id`)
|
||||
REFERENCES `client_connection` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `indicator`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `indicator` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `indicator` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`exam_id` BIGINT UNSIGNED NOT NULL,
|
||||
`type` VARCHAR(45) NOT NULL,
|
||||
`name` VARCHAR(45) NOT NULL,
|
||||
`color` VARCHAR(45) NOT NULL,
|
||||
INDEX `indicator_exam_idx` (`exam_id` ASC),
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `exam_ref`
|
||||
FOREIGN KEY (`exam_id`)
|
||||
REFERENCES `exam` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `configuration_node`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `configuration_node` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `configuration_node` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`institution_id` BIGINT UNSIGNED NOT NULL,
|
||||
`owner` VARCHAR(255) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`description` VARCHAR(4000) NULL,
|
||||
`type` VARCHAR(45) NULL,
|
||||
`template` VARCHAR(255) NULL,
|
||||
`active` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `configurationInstitutionRef_idx` (`institution_id` ASC),
|
||||
CONSTRAINT `configurationInstitutionRef`
|
||||
FOREIGN KEY (`institution_id`)
|
||||
REFERENCES `institution` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `configuration`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `configuration` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `configuration` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`configuration_node_id` BIGINT UNSIGNED NOT NULL,
|
||||
`version` VARCHAR(255) NULL,
|
||||
`version_date` DATETIME NULL,
|
||||
`followup` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `configurationNodeRef_idx` (`configuration_node_id` ASC),
|
||||
CONSTRAINT `configurationNodeRef`
|
||||
FOREIGN KEY (`configuration_node_id`)
|
||||
REFERENCES `configuration_node` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `configuration_attribute`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `configuration_attribute` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `configuration_attribute` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(45) NOT NULL,
|
||||
`type` VARCHAR(45) NOT NULL,
|
||||
`parent_id` BIGINT UNSIGNED NULL,
|
||||
`resources` VARCHAR(255) NULL,
|
||||
`validator` VARCHAR(45) NULL,
|
||||
`dependencies` VARCHAR(255) NULL,
|
||||
`default_value` VARCHAR(255) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `parent_ref_idx` (`parent_id` ASC),
|
||||
CONSTRAINT `parent_ref`
|
||||
FOREIGN KEY (`parent_id`)
|
||||
REFERENCES `configuration_attribute` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `configuration_value`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `configuration_value` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `configuration_value` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`configuration_id` BIGINT UNSIGNED NOT NULL,
|
||||
`configuration_attribute_id` BIGINT UNSIGNED NOT NULL,
|
||||
`list_index` INT NOT NULL DEFAULT 0,
|
||||
`value` VARCHAR(255) NULL,
|
||||
`text` MEDIUMTEXT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `configuration_value_ref_idx` (`configuration_id` ASC),
|
||||
INDEX `configuration_attribute_ref_idx` (`configuration_attribute_id` ASC),
|
||||
CONSTRAINT `configuration_ref`
|
||||
FOREIGN KEY (`configuration_id`)
|
||||
REFERENCES `configuration` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `configuration_value_attribute_ref`
|
||||
FOREIGN KEY (`configuration_attribute_id`)
|
||||
REFERENCES `configuration_attribute` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `orientation`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `orientation` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `orientation` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`config_attribute_id` BIGINT UNSIGNED NOT NULL,
|
||||
`template` VARCHAR(255) NULL,
|
||||
`view` VARCHAR(45) NOT NULL,
|
||||
`group` VARCHAR(45) NULL,
|
||||
`x_position` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`y_position` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`width` INT UNSIGNED NULL,
|
||||
`height` INT UNSIGNED NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `config_attribute_orientation_rev_idx` (`config_attribute_id` ASC),
|
||||
CONSTRAINT `config_attribute_orientation_rev`
|
||||
FOREIGN KEY (`config_attribute_id`)
|
||||
REFERENCES `configuration_attribute` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `exam_configuration_map`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `exam_configuration_map` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `exam_configuration_map` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`exam_id` BIGINT UNSIGNED NOT NULL,
|
||||
`configuration_node_id` BIGINT UNSIGNED NOT NULL,
|
||||
`user_names` VARCHAR(4000) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `exam_ref_idx` (`exam_id` ASC),
|
||||
INDEX `configuration_map_ref_idx` (`configuration_node_id` ASC),
|
||||
CONSTRAINT `exam_map_ref`
|
||||
FOREIGN KEY (`exam_id`)
|
||||
REFERENCES `exam` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `configuration_map_ref`
|
||||
FOREIGN KEY (`configuration_node_id`)
|
||||
REFERENCES `configuration_node` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `user`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `user` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`institution_id` BIGINT UNSIGNED NULL,
|
||||
`uuid` VARCHAR(255) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`username` VARCHAR(255) NOT NULL,
|
||||
`password` VARCHAR(255) NOT NULL,
|
||||
`email` VARCHAR(255) NOT NULL,
|
||||
`locale` VARCHAR(45) NOT NULL,
|
||||
`timeZone` VARCHAR(45) NOT NULL,
|
||||
`active` INT(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `institutionRef_idx` (`institution_id` ASC),
|
||||
CONSTRAINT `institutionRef`
|
||||
FOREIGN KEY (`institution_id`)
|
||||
REFERENCES `institution` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `user_role`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `user_role` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_role` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user_id` BIGINT UNSIGNED NOT NULL,
|
||||
`role_name` VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `user_ref_idx` (`user_id` ASC),
|
||||
CONSTRAINT `user_ref`
|
||||
FOREIGN KEY (`user_id`)
|
||||
REFERENCES `user` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `oauth_access_token`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `oauth_access_token` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `oauth_access_token` (
|
||||
`token_id` VARCHAR(255) NULL,
|
||||
`token` BLOB NULL,
|
||||
`authentication_id` VARCHAR(255) NULL,
|
||||
`user_name` VARCHAR(255) NULL,
|
||||
`client_id` VARCHAR(255) NULL,
|
||||
`authentication` BLOB NULL,
|
||||
`refresh_token` VARCHAR(255) NULL)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `oauth_refresh_token`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `oauth_refresh_token` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `oauth_refresh_token` (
|
||||
`token_id` VARCHAR(255) NULL,
|
||||
`token` BLOB NULL,
|
||||
`authentication` BLOB NULL)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `threshold`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `threshold` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `threshold` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`indicator_id` BIGINT UNSIGNED NOT NULL,
|
||||
`value` DECIMAL(10,4) NOT NULL,
|
||||
`color` VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `indicator_threshold_id_idx` (`indicator_id` ASC),
|
||||
CONSTRAINT `indicator_threshold_id`
|
||||
FOREIGN KEY (`indicator_id`)
|
||||
REFERENCES `indicator` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `user_activity_log`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `user_activity_log` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_activity_log` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user_uuid` VARCHAR(255) NOT NULL,
|
||||
`timestamp` BIGINT NOT NULL,
|
||||
`activity_type` VARCHAR(45) NOT NULL,
|
||||
`entity_type` VARCHAR(45) NOT NULL,
|
||||
`entity_id` VARCHAR(255) NOT NULL,
|
||||
`message` VARCHAR(255) NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `additional_attributes`
|
||||
-- -----------------------------------------------------
|
||||
DROP TABLE IF EXISTS `additional_attributes` ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `additional_attributes` (
|
||||
`id` BIGINT UNSIGNED NOT NULL,
|
||||
`entity_type` VARCHAR(45) NOT NULL,
|
||||
`entity_id` BIGINT UNSIGNED NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`value` VARCHAR(4000) NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
;
|
||||
|
Loading…
Reference in a new issue