diff --git a/code/gms-backend/pom.xml b/code/gms-backend/pom.xml index 6ffe45b2..c8c14c25 100644 --- a/code/gms-backend/pom.xml +++ b/code/gms-backend/pom.xml @@ -255,19 +255,16 @@ org.junit.jupiter junit-jupiter-engine - ${junit.jupiter.version} test org.junit.jupiter junit-jupiter-api - ${junit.jupiter.version} test org.junit.jupiter junit-jupiter-params - ${junit.jupiter.version} test diff --git a/code/gms-backend/src/main/java/io/github/gms/secure/entity/SystemPropertyEntity.java b/code/gms-backend/src/main/java/io/github/gms/secure/entity/SystemPropertyEntity.java index 634fc008..b961eb01 100644 --- a/code/gms-backend/src/main/java/io/github/gms/secure/entity/SystemPropertyEntity.java +++ b/code/gms-backend/src/main/java/io/github/gms/secure/entity/SystemPropertyEntity.java @@ -1,7 +1,5 @@ package io.github.gms.secure.entity; -import java.time.ZonedDateTime; - import io.github.gms.common.abstraction.AbstractGmsEntity; import io.github.gms.common.enums.SystemProperty; import jakarta.persistence.Column; @@ -15,6 +13,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.ZonedDateTime; + /** * @author Peter Szrnka * @since 1.0 @@ -32,11 +32,11 @@ public class SystemPropertyEntity extends AbstractGmsEntity { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @Column(name = "key") + @Column(name = "prop_key") @Enumerated(EnumType.STRING) private SystemProperty key; - @Column(name = "value") + @Column(name = "prop_value") private String value; @Column(name = "last_modified") diff --git a/code/gms-backend/src/main/resources/db/mariadb/migration/V1.0.0__initial_script.sql b/code/gms-backend/src/main/resources/db/mariadb/migration/V1.0.0__initial_script.sql index 84f3d253..c397b3c5 100644 --- a/code/gms-backend/src/main/resources/db/mariadb/migration/V1.0.0__initial_script.sql +++ b/code/gms-backend/src/main/resources/db/mariadb/migration/V1.0.0__initial_script.sql @@ -1,63 +1,63 @@ CREATE TABLE gms_user ( id BIGINT(20) NOT NULL AUTO_INCREMENT, creation_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - credential VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - email VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - name VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - roles VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - status VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - user_name VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + credential VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + email VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + roles VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + status VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + user_name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_api_key ( id BIGINT(20) NOT NULL AUTO_INCREMENT, creation_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - name VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - status VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + status VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', user_id BIGINT(20) NOT NULL, - value VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', + value VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_event ( id BIGINT(20) NOT NULL AUTO_INCREMENT, event_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - operation VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - target VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - user_id BIGINT(20) NOT NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + operation VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + target VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + user_id BIGINT(20) NOT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_keystore ( id BIGINT(20) NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', creation_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - credential VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - file_name VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - status VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - type VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + credential VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + file_name VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + status VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + type VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', user_id BIGINT(20) NULL DEFAULT NULL, PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_keystore_alias ( id BIGINT(20) NOT NULL AUTO_INCREMENT, keystore_id BIGINT(20) NULL DEFAULT NULL, - alias VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - alias_credential VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - algorithm VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + alias VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + alias_credential VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + algorithm VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_secret ( id BIGINT(20) NOT NULL AUTO_INCREMENT, @@ -67,25 +67,25 @@ CREATE TABLE gms_secret ( last_updated TIMESTAMP NOT NULL DEFAULT current_timestamp(), return_decrypted INT(1) NOT NULL DEFAULT 1, rotation_enabled INT(1) NOT NULL DEFAULT 1, - rotation_period VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - secret_id VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - status VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - secret_type VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + rotation_period VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + secret_id VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + status VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + secret_type VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', user_id BIGINT(20) NOT NULL, - value VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', + value VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_announcement ( id BIGINT(20) NOT NULL AUTO_INCREMENT, author_id BIGINT(20) NOT NULL, announcement_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - title VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + title VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_message ( id BIGINT(20) NOT NULL AUTO_INCREMENT, @@ -95,7 +95,7 @@ CREATE TABLE gms_message ( opened TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_api_key_restriction ( id BIGINT(20) NOT NULL AUTO_INCREMENT, @@ -104,13 +104,35 @@ CREATE TABLE gms_api_key_restriction ( user_id BIGINT(20) NOT NULL, PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_system_property ( id BIGINT NOT NULL AUTO_INCREMENT, - key VARCHAR(255) NULL DEFAULT NULL, - value VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + prop_key VARCHAR(255) NULL DEFAULT NULL, + prop_value VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', last_modified TIMESTAMP NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; \ No newline at end of file +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; + +CREATE INDEX idx_gms_user ON gms_user(id); +CREATE INDEX idx_gms_api_key ON gms_api_key(id); +CREATE INDEX idx_gms_event ON gms_event(id); +CREATE INDEX idx_gms_keystore ON gms_keystore(id); +CREATE INDEX idx_gms_ks_alias ON gms_keystore_alias(id); +CREATE INDEX idx_gms_secret ON gms_secret(id); +CREATE INDEX idx_gms_announcement ON gms_announcement(id); +CREATE INDEX idx_gms_message ON gms_message(id); +CREATE INDEX idx_gms_api_kr ON gms_api_key_restriction(id); +CREATE INDEX idx_gms_sys_prop ON gms_system_property(id); + +CREATE UNIQUE INDEX idx_unq_gms_user ON gms_user(id); +CREATE UNIQUE INDEX idx_unq_gms_api_key ON gms_api_key(id); +CREATE UNIQUE INDEX idx_unq_gms_event ON gms_event(id); +CREATE UNIQUE INDEX idx_unq_gms_keystore ON gms_keystore(id); +CREATE UNIQUE INDEX idx_unq_gms_ks_alias ON gms_keystore_alias(id); +CREATE UNIQUE INDEX idx_unq_gms_secret ON gms_secret(id); +CREATE UNIQUE INDEX id_unq_gms_announcement ON gms_announcement(id); +CREATE UNIQUE INDEX idx_unq_gms_message ON gms_message(id); +CREATE UNIQUE INDEX idx_unq_gms_api_kr ON gms_api_key_restriction(id); +CREATE UNIQUE INDEX idx_unq_gms_sys_prop ON gms_system_property(id); diff --git a/code/gms-backend/src/main/resources/db/mssql/migration/V1.0.0__initial_script.sql b/code/gms-backend/src/main/resources/db/mssql/migration/V1.0.0__initial_script.sql index 583d5681..621e1de2 100644 --- a/code/gms-backend/src/main/resources/db/mssql/migration/V1.0.0__initial_script.sql +++ b/code/gms-backend/src/main/resources/db/mssql/migration/V1.0.0__initial_script.sql @@ -26,7 +26,7 @@ CREATE TABLE gms_event ( event_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, operation VARCHAR(255) NULL DEFAULT NULL, target VARCHAR(255) NULL DEFAULT NULL, - user_id BIGINT NOT NULL DEFAULT NULL, + user_id BIGINT NOT NULL, PRIMARY KEY (id) ); @@ -98,8 +98,30 @@ CREATE TABLE gms_api_key_restriction ( CREATE TABLE gms_system_property ( id BIGINT NOT NULL IDENTITY(1, 1), - key VARCHAR(255) NULL DEFAULT NULL, - value VARCHAR(255) NULL DEFAULT NULL, - last_modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + prop_key VARCHAR(255) NULL DEFAULT NULL, + prop_value VARCHAR(255) NULL DEFAULT NULL, + last_modified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) -); \ No newline at end of file +); + +CREATE INDEX idx_gms_user ON gms_user(id); +CREATE INDEX idx_gms_api_key ON gms_api_key(id); +CREATE INDEX idx_gms_event ON gms_event(id); +CREATE INDEX idx_gms_keystore ON gms_keystore(id); +CREATE INDEX idx_gms_ks_alias ON gms_keystore_alias(id); +CREATE INDEX idx_gms_secret ON gms_secret(id); +CREATE INDEX idx_gms_announcement ON gms_announcement(id); +CREATE INDEX idx_gms_message ON gms_message(id); +CREATE INDEX idx_gms_api_kr ON gms_api_key_restriction(id); +CREATE INDEX idx_gms_sys_prop ON gms_system_property(id); + +CREATE UNIQUE INDEX idx_unq_gms_user ON gms_user(id); +CREATE UNIQUE INDEX idx_unq_gms_api_key ON gms_api_key(id); +CREATE UNIQUE INDEX idx_unq_gms_event ON gms_event(id); +CREATE UNIQUE INDEX idx_unq_gms_keystore ON gms_keystore(id); +CREATE UNIQUE INDEX idx_unq_gms_ks_alias ON gms_keystore_alias(id); +CREATE UNIQUE INDEX idx_unq_gms_secret ON gms_secret(id); +CREATE UNIQUE INDEX id_unq_gms_announcement ON gms_announcement(id); +CREATE UNIQUE INDEX idx_unq_gms_message ON gms_message(id); +CREATE UNIQUE INDEX idx_unq_gms_api_kr ON gms_api_key_restriction(id); +CREATE UNIQUE INDEX idx_unq_gms_sys_prop ON gms_system_property(id); diff --git a/code/gms-backend/src/main/resources/db/mysql/migration/V1.0.0__initial_script.sql b/code/gms-backend/src/main/resources/db/mysql/migration/V1.0.0__initial_script.sql index ee0b0cf1..f78b7890 100644 --- a/code/gms-backend/src/main/resources/db/mysql/migration/V1.0.0__initial_script.sql +++ b/code/gms-backend/src/main/resources/db/mysql/migration/V1.0.0__initial_script.sql @@ -28,36 +28,36 @@ CREATE TABLE gms_event ( event_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), operation VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', target VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', - user_id BIGINT NOT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + user_id BIGINT NOT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_keystore ( id BIGINT(20) NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', creation_date TIMESTAMP NOT NULL DEFAULT current_timestamp(), - credential VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - file_name VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - status VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', - type VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci', + credential VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + file_name VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + status VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', + type VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci', user_id BIGINT(20) NULL DEFAULT NULL, PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_keystore_alias ( id BIGINT(20) NOT NULL AUTO_INCREMENT, keystore_id BIGINT(20) NULL DEFAULT NULL, - alias VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - alias_credential VARCHAR(512) NOT NULL COLLATE 'utf8mb3_general_ci', - description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', - algorithm VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + alias VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + alias_credential VARCHAR(512) NOT NULL COLLATE 'utf8mb4_general_ci', + description VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + algorithm VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb3_general_ci' ENGINE=InnoDB; +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_secret ( id BIGINT NOT NULL AUTO_INCREMENT, @@ -108,9 +108,31 @@ COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; CREATE TABLE gms_system_property ( id BIGINT NOT NULL AUTO_INCREMENT, - key VARCHAR(255) NULL DEFAULT NULL, - value VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci', + prop_key VARCHAR(255) NULL DEFAULT NULL, + prop_value VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', last_modified TIMESTAMP NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (id) USING BTREE ) -COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; \ No newline at end of file +COLLATE='utf8mb4_general_ci' ENGINE=InnoDB; + +CREATE INDEX idx_gms_user ON gms_user(id); +CREATE INDEX idx_gms_api_key ON gms_api_key(id); +CREATE INDEX idx_gms_event ON gms_event(id); +CREATE INDEX idx_gms_keystore ON gms_keystore(id); +CREATE INDEX idx_gms_ks_alias ON gms_keystore_alias(id); +CREATE INDEX idx_gms_secret ON gms_secret(id); +CREATE INDEX idx_gms_announcement ON gms_announcement(id); +CREATE INDEX idx_gms_message ON gms_message(id); +CREATE INDEX idx_gms_api_kr ON gms_api_key_restriction(id); +CREATE INDEX idx_gms_sys_prop ON gms_system_property(id); + +CREATE UNIQUE INDEX idx_unq_gms_user ON gms_user(id); +CREATE UNIQUE INDEX idx_unq_gms_api_key ON gms_api_key(id); +CREATE UNIQUE INDEX idx_unq_gms_event ON gms_event(id); +CREATE UNIQUE INDEX idx_unq_gms_keystore ON gms_keystore(id); +CREATE UNIQUE INDEX idx_unq_gms_ks_alias ON gms_keystore_alias(id); +CREATE UNIQUE INDEX idx_unq_gms_secret ON gms_secret(id); +CREATE UNIQUE INDEX id_unq_gms_announcement ON gms_announcement(id); +CREATE UNIQUE INDEX idx_unq_gms_message ON gms_message(id); +CREATE UNIQUE INDEX idx_unq_gms_api_kr ON gms_api_key_restriction(id); +CREATE UNIQUE INDEX idx_unq_gms_sys_prop ON gms_system_property(id); diff --git a/code/gms-backend/src/main/resources/db/postgresql/migration/V1.0.0__initial_script.sql b/code/gms-backend/src/main/resources/db/postgresql/migration/V1.0.0__initial_script.sql index 4c333c52..3d393ceb 100644 --- a/code/gms-backend/src/main/resources/db/postgresql/migration/V1.0.0__initial_script.sql +++ b/code/gms-backend/src/main/resources/db/postgresql/migration/V1.0.0__initial_script.sql @@ -91,7 +91,29 @@ CREATE TABLE gms_api_key_restriction ( CREATE TABLE gms_system_property ( id SERIAL PRIMARY KEY, - key VARCHAR(255) NULL DEFAULT NULL, - value VARCHAR(255) NULL DEFAULT NULL, + prop_key VARCHAR(255) NULL DEFAULT NULL, + prop_value VARCHAR(255) NULL DEFAULT NULL, last_modified TIMESTAMP NOT NULL DEFAULT current_timestamp -); \ No newline at end of file +); + +CREATE INDEX idx_gms_user ON gms_user(id); +CREATE INDEX idx_gms_api_key ON gms_api_key(id); +CREATE INDEX idx_gms_event ON gms_event(id); +CREATE INDEX idx_gms_keystore ON gms_keystore(id); +CREATE INDEX idx_gms_ks_alias ON gms_keystore_alias(id); +CREATE INDEX idx_gms_secret ON gms_secret(id); +CREATE INDEX idx_gms_announcement ON gms_announcement(id); +CREATE INDEX idx_gms_message ON gms_message(id); +CREATE INDEX idx_gms_api_kr ON gms_api_key_restriction(id); +CREATE INDEX idx_gms_sys_prop ON gms_system_property(id); + +CREATE UNIQUE INDEX idx_unq_gms_user ON gms_user(id); +CREATE UNIQUE INDEX idx_unq_gms_api_key ON gms_api_key(id); +CREATE UNIQUE INDEX idx_unq_gms_event ON gms_event(id); +CREATE UNIQUE INDEX idx_unq_gms_keystore ON gms_keystore(id); +CREATE UNIQUE INDEX idx_unq_gms_ks_alias ON gms_keystore_alias(id); +CREATE UNIQUE INDEX idx_unq_gms_secret ON gms_secret(id); +CREATE UNIQUE INDEX id_unq_gms_announcement ON gms_announcement(id); +CREATE UNIQUE INDEX idx_unq_gms_message ON gms_message(id); +CREATE UNIQUE INDEX idx_unq_gms_api_kr ON gms_api_key_restriction(id); +CREATE UNIQUE INDEX idx_unq_gms_sys_prop ON gms_system_property(id);