--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info 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.v65;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
+import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class AddIndexRulesProfileUuidOnQProfileChanges extends DdlChange {
+
+ private static final String TABLE_NAME = "qprofile_changes";
+ private static final String COLUMN_NAME = "rules_profile_uuid";
+ private static final String NEW_INDEX_NAME = "qp_changes_rules_profile_uuid";
+
+ public AddIndexRulesProfileUuidOnQProfileChanges(Database db) {
+ super(db);
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ VarcharColumnDef rulesProfileUuid = VarcharColumnDef.newVarcharColumnDefBuilder()
+ .setColumnName(COLUMN_NAME)
+ .setLimit(255)
+ .setIsNullable(false)
+ .build();
+
+ context.execute(new CreateIndexBuilder(getDialect())
+ .setName(NEW_INDEX_NAME)
+ .setTable(TABLE_NAME)
+ .addColumn(rulesProfileUuid)
+ .build()
+ );
+ }
+}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.v65;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
-import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddIndexRulesProfileUuidOnQProfileChangesIsIndexed extends DdlChange {
-
- private static final String TABLE_NAME = "qprofile_changes";
- private static final String COLUMN_NAME = "rules_profile_uuid";
- private static final String NEW_INDEX_NAME = "qp_changes_rules_profile_uuid";
-
- public AddIndexRulesProfileUuidOnQProfileChangesIsIndexed(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef rulesProfileUuid = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(COLUMN_NAME)
- .setLimit(255)
- .setIsNullable(false)
- .build();
-
- context.execute(new CreateIndexBuilder(getDialect())
- .setName(NEW_INDEX_NAME)
- .setTable(TABLE_NAME)
- .addColumn(rulesProfileUuid)
- .build()
- );
- }
-}
.add(1723, "Populate table qprofiles", PopulateOrgQProfiles.class)
.add(1724, "Drop columns organization_uuid and parent_kee from rules_profiles", DropOrgColumnsFromRulesProfiles.class)
.add(1725, "Mark rules_profiles.is_built_in to true for default organization", SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.class)
- .add(1726, "Update OrgQProfiles to point to built-in profiles", UpdateOrgQProfilesToPointToBuiltInProfiles.class)
- .add(1727, "Rename column qprofile_changes.qprofile_key to qprofile_changes.rules_profile_uuid", RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.class)
- .add(1728, "Ensure presence of index on qprofile_changes.rules_profile_uuid", AddIndexRulesProfileUuidOnQProfileChangesIsIndexed.class);
+ .add(1726, "Update org_qprofiles to reference built-in profiles", UpdateOrgQProfilesToPointToBuiltInProfiles.class)
+ .add(1727, "Delete rules_profiles orphans", DeleteOrphansFromRulesProfiles.class)
+ .add(1728, "Rename column qprofile_changes.qprofile_key to qprofile_changes.rules_profile_uuid", RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.class)
+ .add(1729, "Add index on qprofile_changes.rules_profile_uuid", AddIndexRulesProfileUuidOnQProfileChanges.class);
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.v65;
-
-import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-public class AddIndexRulesProfileUuidOnQProfileChangesIsIndexedTest {
-
- private static final String TABLE_NAME = "qprofile_changes";
- private static final String COLUMN_NAME = "rules_profile_uuid";
- private static final String INDEX_NAME = "qp_changes_rules_profile_uuid";
-
- @Rule
- public CoreDbTester db = CoreDbTester.createForSchema(AddIndexRulesProfileUuidOnQProfileChangesIsIndexedTest.class, "initial.sql");
-
- private AddIndexRulesProfileUuidOnQProfileChangesIsIndexed underTest = new AddIndexRulesProfileUuidOnQProfileChangesIsIndexed(db.database());
-
- @Test
- public void add_index_ON_RULES_PROFILE_UUID_of_QPROFILE_CHANGES() throws SQLException {
- underTest.execute();
-
- db.assertIndex(TABLE_NAME, INDEX_NAME,COLUMN_NAME);
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info 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.v65;
+
+import java.sql.SQLException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+
+public class AddIndexRulesProfileUuidOnQProfileChangesTest {
+
+ private static final String TABLE_NAME = "qprofile_changes";
+ private static final String COLUMN_NAME = "rules_profile_uuid";
+ private static final String INDEX_NAME = "qp_changes_rules_profile_uuid";
+
+ @Rule
+ public CoreDbTester db = CoreDbTester.createForSchema(AddIndexRulesProfileUuidOnQProfileChangesTest.class, "initial.sql");
+
+ private AddIndexRulesProfileUuidOnQProfileChanges underTest = new AddIndexRulesProfileUuidOnQProfileChanges(db.database());
+
+ @Test
+ public void add_index_ON_RULES_PROFILE_UUID_of_QPROFILE_CHANGES() throws SQLException {
+ underTest.execute();
+
+ db.assertIndex(TABLE_NAME, INDEX_NAME,COLUMN_NAME);
+ }
+}
@Test
public void verify_migration_count() {
- verifyMigrationCount(underTest, 29);
+ verifyMigrationCount(underTest, 30);
}
}
+++ /dev/null
-CREATE TABLE "QPROFILE_CHANGES" (
- "KEE" VARCHAR(40) NOT NULL PRIMARY KEY,
- "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL,
- "CHANGE_TYPE" VARCHAR(20) NOT NULL,
- "CREATED_AT" BIGINT NOT NULL,
- "USER_LOGIN" VARCHAR(255),
- "CHANGE_DATA" CLOB
-);
-CREATE INDEX "QPROFILE_CHANGES_QPROFILE_KEY" ON "QPROFILE_CHANGES" ("RULES_PROFILE_UUID");
--- /dev/null
+CREATE TABLE "QPROFILE_CHANGES" (
+ "KEE" VARCHAR(40) NOT NULL PRIMARY KEY,
+ "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL,
+ "CHANGE_TYPE" VARCHAR(20) NOT NULL,
+ "CREATED_AT" BIGINT NOT NULL,
+ "USER_LOGIN" VARCHAR(255),
+ "CHANGE_DATA" CLOB
+);
+CREATE INDEX "QPROFILE_CHANGES_QPROFILE_KEY" ON "QPROFILE_CHANGES" ("RULES_PROFILE_UUID");