Added VirtualCorpus DAO methods and tests.
Change-Id: Id178f922578fb5aa2516da9a485ea6a43eaea587
diff --git a/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql b/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
index d558e47..44b49e3 100644
--- a/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
+++ b/full/src/main/resources/db/new-mysql/V1.1__create_virtual_corpus_tables.sql
@@ -2,7 +2,8 @@
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name varchar(100) NOT NULL,
status varchar(100) NOT NULL,
- created_by varchar(100) NOT NULL
+ created_by varchar(100) NOT NULL,
+ INDEX status_index(status)
);
CREATE TABLE IF NOT EXISTS user_group_member (
@@ -13,15 +14,15 @@
created_by varchar(100) NOT NULL,
deleted_by varchar(100) DEFAULT NULL,
UNIQUE INDEX unique_index (user_id,group_id),
+ INDEX status_index(status),
FOREIGN KEY (group_id)
REFERENCES user_group (id)
ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS role (
- id varchar(100) NOT NULL,
- privilege varchar(100) NOT NULL,
- PRIMARY KEY (id)
+ id varchar(100) PRIMARY KEY NOT NULL,
+ privilege varchar(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS group_member_role (
@@ -46,7 +47,9 @@
description varchar(255) DEFAULT NULL,
status varchar(100) DEFAULT NULL,
collection_query varchar(2000) NOT NULL,
- definition varchar(255) DEFAULT NULL
+ definition varchar(255) DEFAULT NULL,
+ INDEX owner_index (created_by),
+ INDEX type_index (type)
);
CREATE TABLE IF NOT EXISTS virtual_corpus_access (
@@ -58,6 +61,7 @@
approved_by varchar(100) DEFAULT NULL,
deleted_by varchar(100) DEFAULT NULL,
UNIQUE INDEX unique_index (virtual_corpus_id,user_group_id),
+ INDEX status_index(status),
FOREIGN KEY (user_group_id)
REFERENCES user_group (id)
ON DELETE CASCADE,
diff --git a/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql b/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
index 1d1cc9b..442a39c 100644
--- a/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
+++ b/full/src/main/resources/db/new-mysql/V3.1__insert_virtual_corpus.sql
@@ -36,6 +36,11 @@
(SELECT id from user_group where name = "dory group"),
"DELETED","dory", "pearl";
+INSERT INTO user_group_member(user_id, group_id, status, created_by)
+ SELECT "pearl",
+ (SELECT id from user_group where name = "auto group"),
+ "ACTIVE","system";
+
-- virtual corpora
INSERT INTO virtual_corpus(name, type, required_access, created_by, description, status, collection_query)
@@ -79,6 +84,6 @@
-- Summary user VC Lists
-- dory: dory VC, group VC, system VC
--- nemo: group VC, published VC, system VC
+-- nemo: group VC, system VC
-- marlin: published VC, system VC
--- pearl: system VC
+-- pearl: system VC, published VC
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index c6cd7d2..869059b 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -97,12 +97,12 @@
<!-- to configure database for sqlite, mysql, etc. migrations -->
<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
- <property name="baselineOnMigrate" value="false" />
+ <property name="baselineOnMigrate" value="true" />
<!-- <property name="validateOnMigrate" value="false" /> -->
<!-- <property name="cleanOnValidationError" value="true" /> -->
<property name="locations" value="${jdbc.schemaPath}" />
- <!-- <property name="dataSource" ref="dataSource" /> -->
- <property name="dataSource" ref="sqliteDataSource" />
+ <property name="dataSource" ref="dataSource" />
+ <!-- <property name="dataSource" ref="sqliteDataSource" /> -->
</bean>