]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8754 add column ORGANIZATIONS.GUARDED
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 7 Feb 2017 16:43:58 +0000 (17:43 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 10 Feb 2017 08:48:36 +0000 (09:48 +0100)
13 files changed:
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizations.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DbVersion63.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullable.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizations.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DbVersion63Test.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest/previous-organizations.sql [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest/organizations_with_nullable_guarded.sql [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest/organizations.sql [new file with mode: 0644]
sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl

diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizations.java
new file mode 100644 (file)
index 0000000..7457357
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.def.BooleanColumnDef;
+import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class AddColumnGuardedToOrganizations extends DdlChange {
+  public AddColumnGuardedToOrganizations(Database db) {
+    super(db);
+  }
+
+  @Override
+  public void execute(Context context) throws SQLException {
+    context.execute(
+      new AddColumnsBuilder(getDialect(), "organizations")
+        .addColumn(
+          BooleanColumnDef.newBooleanColumnDefBuilder()
+            .setColumnName("guarded")
+            .setIsNullable(true)
+            .build())
+        .build());
+  }
+}
index 9aae9b502f753e586bc7b551e78ce430573a1ac0..82fc9f8f6411e3a0f30c4c0ea2078ddd131c6f2c 100644 (file)
@@ -41,6 +41,9 @@ public class DbVersion63 implements DbVersion {
       .add(1506, "Add index on PROJECTS.ORGANIZATION_UUID", AddIndexOnOrganizationUuidOfProjects.class)
       .add(1507, "Drop table RESOURCE_INDEX", DropTableResourceIndex.class)
       .add(1508, "Add columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*", AddDefaultPermTemplateColumnsToOrganizations.class)
-      .add(1509, "Populate columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*", PopulateDefaultPermTemplateColumnsOfOrganizations.class);
+      .add(1509, "Populate columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*", PopulateDefaultPermTemplateColumnsOfOrganizations.class)
+      .add(1510, "Add ORGANIZATIONS.GUARDED", AddColumnGuardedToOrganizations.class)
+      .add(1511, "Populate ORGANIZATIONS.GUARDED", PopulateColumnGuardedOfOrganizations.class)
+      .add(1512, "Make ORGANIZATIONS.GUARDED not nullable", MakeColumnGuardedOfOrganizationsNotNullable.class);
   }
 }
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullable.java
new file mode 100644 (file)
index 0000000..bfbbe6d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.def.BooleanColumnDef;
+import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class MakeColumnGuardedOfOrganizationsNotNullable extends DdlChange {
+  public MakeColumnGuardedOfOrganizationsNotNullable(Database db) {
+    super(db);
+  }
+
+  @Override
+  public void execute(Context context) throws SQLException {
+    context.execute(
+      new AlterColumnsBuilder(getDialect(), "organizations")
+        .updateColumn(
+          BooleanColumnDef.newBooleanColumnDefBuilder()
+            .setColumnName("guarded")
+            .setIsNullable(false)
+            .build())
+        .build());
+  }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizations.java
new file mode 100644 (file)
index 0000000..887ca6f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DataChange;
+import org.sonar.server.platform.db.migration.step.MassUpdate;
+
+public class PopulateColumnGuardedOfOrganizations extends DataChange {
+  public PopulateColumnGuardedOfOrganizations(Database db) {
+    super(db);
+  }
+
+  @Override
+  protected void execute(Context context) throws SQLException {
+    MassUpdate massUpdate = context.prepareMassUpdate();
+    massUpdate.select("select uuid from organizations where guarded is null");
+    massUpdate.update("update organizations set guarded=? where uuid=?");
+    massUpdate.rowPluralName("organizations");
+    massUpdate.execute((row, statement) -> {
+      String organizationUuid = row.getString(1);
+
+      statement.setBoolean(1, false);
+      statement.setString(2, organizationUuid);
+      return true;
+    });
+  }
+}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest.java
new file mode 100644 (file)
index 0000000..de8ced8
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import java.sql.Types;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.api.utils.System2;
+import org.sonar.db.DbTester;
+
+public class AddColumnGuardedToOrganizationsTest {
+
+  @Rule
+  public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, AddColumnGuardedToOrganizationsTest.class, "previous-organizations.sql");
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  private AddColumnGuardedToOrganizations underTest = new AddColumnGuardedToOrganizations(dbTester.database());
+
+  @Test
+  public void add_nullable_boolean_column_guarded_to_table_organizations() throws SQLException {
+    underTest.execute();
+
+    dbTester.assertColumnDefinition("organizations", "guarded", Types.BOOLEAN, null, true);
+  }
+
+  @Test
+  public void migration_is_not_reentrant() throws SQLException {
+    underTest.execute();
+
+    expectedException.expect(IllegalStateException.class);
+
+    underTest.execute();
+  }
+
+}
index 3512ef01c85800a3f5cee897cb512a09f4adf450..d9c06f27d62fffb2da798b7ff0d0b589740466a8 100644 (file)
@@ -41,7 +41,7 @@ public class DbVersion63Test {
 
   @Test
   public void verify_migration_count() {
-    verifyMigrationCount(underTest, 10);
+    verifyMigrationCount(underTest, 13);
   }
 
 }
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest.java
new file mode 100644 (file)
index 0000000..b60f897
--- /dev/null
@@ -0,0 +1,63 @@
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import java.sql.Types;
+import javax.annotation.Nullable;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.api.utils.System2;
+import org.sonar.db.DbTester;
+
+public class MakeColumnGuardedOfOrganizationsNotNullableTest {
+  private static final String TABLE_ORGANIZATIONS = "organizations";
+
+  @Rule
+  public DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, MakeColumnGuardedOfOrganizationsNotNullableTest.class, "organizations_with_nullable_guarded.sql");
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  private MakeColumnGuardedOfOrganizationsNotNullable underTest = new MakeColumnGuardedOfOrganizationsNotNullable(dbTester.database());
+
+  @Test
+  public void migration_sets_guarded_column_not_nullable_on_empty_table() throws SQLException {
+    underTest.execute();
+
+    verifyColumnDefinition();
+  }
+
+  @Test
+  public void migration_sets_guarded_column_not_nullable_on_populated_table() throws SQLException {
+    insertOrganization("org_A", true);
+    insertOrganization("org_B", false);
+
+    underTest.execute();
+
+    verifyColumnDefinition();
+  }
+
+  @Test
+  public void migration_fails_if_some_row_has_a_null_guarded() throws SQLException {
+    insertOrganization("org_c", null);
+
+    expectedException.expect(IllegalStateException.class);
+    expectedException.expectMessage("Fail to execute");
+
+    underTest.execute();
+  }
+
+  private void verifyColumnDefinition() {
+    dbTester.assertColumnDefinition(TABLE_ORGANIZATIONS, "guarded", Types.BOOLEAN, null, false);
+  }
+
+  private void insertOrganization(String uuid, @Nullable Boolean guarded) {
+    dbTester.executeInsert(
+      "ORGANIZATIONS",
+      "UUID", uuid,
+      "KEE", uuid,
+      "NAME", uuid,
+      "GUARDED", guarded == null ? null : String.valueOf(guarded),
+      "CREATED_AT", "1000",
+      "UPDATED_AT", "1000");
+  }
+}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest.java
new file mode 100644 (file)
index 0000000..657a470
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v63;
+
+import java.sql.SQLException;
+import javax.annotation.Nullable;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.api.utils.System2;
+import org.sonar.db.DbTester;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class PopulateColumnGuardedOfOrganizationsTest {
+
+  @Rule
+  public DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, PopulateColumnGuardedOfOrganizationsTest.class, "organizations.sql");
+
+  private PopulateColumnGuardedOfOrganizations underTest = new PopulateColumnGuardedOfOrganizations(dbTester.database());
+
+  @Test
+  public void execute_has_no_effect_when_table_is_empty() throws SQLException {
+    underTest.execute();
+  }
+
+  @Test
+  public void execute_is_reentrant_when_table_is_empty() throws SQLException {
+    underTest.execute();
+
+    underTest.execute();
+  }
+
+  @Test
+  public void execute_sets_is_protected_to_false_for_all_rows() throws SQLException {
+    insertOrganization("u1", null);
+    insertOrganization("u2", null);
+
+    underTest.execute();
+
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded is null")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded is not null")).isEqualTo(2);
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded=false")).isEqualTo(2);
+  }
+
+  @Test
+  public void execute_is_reentrant_when_table_had_data() throws SQLException {
+    insertOrganization("u1", true);
+    insertOrganization("u2", null);
+
+    underTest.execute();
+
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded is null")).isEqualTo(0);
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded is not null")).isEqualTo(2);
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded=false")).isEqualTo(1);
+    assertThat(dbTester.countSql("select count(*) from organizations where guarded=true")).isEqualTo(1);
+
+    underTest.execute();
+  }
+
+  @Test
+  public void execute_is_reentrant_when_table_had_partially_migrated_data() throws SQLException {
+    insertOrganization("u1", false);
+    insertOrganization("u2", null);
+
+    underTest.execute();
+  }
+
+  private void insertOrganization(String uuid, @Nullable Boolean guarded) {
+    dbTester.executeInsert(
+      "ORGANIZATIONS",
+      "UUID", uuid,
+      "KEE", uuid,
+      "NAME", uuid,
+      "GUARDED", guarded == null ? null : String.valueOf(guarded),
+      "CREATED_AT", "1000",
+      "UPDATED_AT", "1000");
+  }
+
+}
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest/previous-organizations.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest/previous-organizations.sql
new file mode 100644 (file)
index 0000000..9275a44
--- /dev/null
@@ -0,0 +1,14 @@
+CREATE TABLE "ORGANIZATIONS" (
+  "UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
+  "KEE" VARCHAR(32) NOT NULL,
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(256),
+  "URL" VARCHAR(256),
+  "AVATAR_URL" VARCHAR(256),
+  "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40),
+  "DEFAULT_PERM_TEMPLATE_VIEW" VARCHAR(40),
+  "CREATED_AT" BIGINT NOT NULL,
+  "UPDATED_AT" BIGINT NOT NULL
+);
+CREATE UNIQUE INDEX "PK_ORGANIZATIONS" ON "ORGANIZATIONS" ("UUID");
+CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS" ("KEE");
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest/organizations_with_nullable_guarded.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest/organizations_with_nullable_guarded.sql
new file mode 100644 (file)
index 0000000..0600e9c
--- /dev/null
@@ -0,0 +1,15 @@
+CREATE TABLE "ORGANIZATIONS" (
+  "UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
+  "KEE" VARCHAR(32) NOT NULL,
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(256),
+  "URL" VARCHAR(256),
+  "AVATAR_URL" VARCHAR(256),
+  "GUARDED" BOOLEAN,
+  "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40),
+  "DEFAULT_PERM_TEMPLATE_VIEW" VARCHAR(40),
+  "CREATED_AT" BIGINT NOT NULL,
+  "UPDATED_AT" BIGINT NOT NULL
+);
+CREATE UNIQUE INDEX "PK_ORGANIZATIONS" ON "ORGANIZATIONS" ("UUID");
+CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS" ("KEE");
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest/organizations.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest/organizations.sql
new file mode 100644 (file)
index 0000000..0600e9c
--- /dev/null
@@ -0,0 +1,15 @@
+CREATE TABLE "ORGANIZATIONS" (
+  "UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
+  "KEE" VARCHAR(32) NOT NULL,
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(256),
+  "URL" VARCHAR(256),
+  "AVATAR_URL" VARCHAR(256),
+  "GUARDED" BOOLEAN,
+  "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40),
+  "DEFAULT_PERM_TEMPLATE_VIEW" VARCHAR(40),
+  "CREATED_AT" BIGINT NOT NULL,
+  "UPDATED_AT" BIGINT NOT NULL
+);
+CREATE UNIQUE INDEX "PK_ORGANIZATIONS" ON "ORGANIZATIONS" ("UUID");
+CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS" ("KEE");
index 26c5cd9909f2912f0b94bcab4777599c3c99660c..00d131c627caf57103f448e80d6adcaed9cb5ef1 100644 (file)
@@ -523,6 +523,9 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1506');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1507');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1508');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1509');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1510');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1511');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1512');
 
 INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, IS_ROOT, CREATED_AT, UPDATED_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', true, '1418215735482', '1418215735482');
 ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
index ab505c6741f24a9e1985b850ac7adf782d63016f..742cdc0d75c27f1c839794f705774ed218c27a63 100644 (file)
@@ -5,6 +5,7 @@ CREATE TABLE "ORGANIZATIONS" (
   "DESCRIPTION" VARCHAR(256),
   "URL" VARCHAR(256),
   "AVATAR_URL" VARCHAR(256),
+  "GUARDED" BOOLEAN NOT NULL,
   "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40),
   "DEFAULT_PERM_TEMPLATE_VIEW" VARCHAR(40),
   "CREATED_AT" BIGINT NOT NULL,