diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-17 23:53:03 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-17 23:53:03 +0100 |
commit | 362a1e6070184c58cbb8d0f6a252c26260367065 (patch) | |
tree | 124d05f041926665aa0c73a4b2e07798dcb687fc /sonar-core/src/main | |
parent | 97ecdc3d58f85ddc2914a5730dbb06dafcd16b8c (diff) | |
download | sonarqube-362a1e6070184c58cbb8d0f6a252c26260367065.tar.gz sonarqube-362a1e6070184c58cbb8d0f6a252c26260367065.zip |
SONAR-4950 Create an unique constraint on the "group_roles" table to prevent having two rows with same group_id, resource_id and role
Diffstat (limited to 'sonar-core/src/main')
3 files changed, 4 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index 79b894f1677..f9785136f17 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 481; + public static final int LAST_VERSION = 482; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 6903625df31..3c128f020a1 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -192,6 +192,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('465'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('466'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('480'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('481'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('482'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index f0ebea6fca1..670337719f1 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -690,6 +690,8 @@ CREATE INDEX "SNAPSHOTS_ROOT_PROJECT_ID" ON "SNAPSHOTS" ("ROOT_PROJECT_ID"); CREATE INDEX "GROUP_ROLES_ROLE" ON "GROUP_ROLES" ("ROLE"); +CREATE UNIQUE INDEX "GROUP_ROLES_UNIQUE" ON "GROUP_ROLES" ("GROUP_ID", "RESOURCE_ID", "ROLE"); + CREATE UNIQUE INDEX "RULES_PLUGIN_KEY_AND_NAME" ON "RULES" ("PLUGIN_RULE_KEY", "PLUGIN_NAME"); CREATE INDEX "CHARACTERISTICS_ENABLED" ON "CHARACTERISTICS" ("ENABLED"); |