"TMP_MAIN_COMPONENT_UUID" VARCHAR(40) NULL,
"ANALYSIS_UUID" VARCHAR(50) NULL,
"STATUS" VARCHAR(15) NOT NULL,
- "IS_LAST" BOOLEAN NOT NULL,
- "IS_LAST_KEY" VARCHAR(55) NOT NULL,
+ "IS_LAST" BOOLEAN,
+ "IS_LAST_KEY" VARCHAR(55),
"TMP_IS_LAST" BOOLEAN,
"TMP_IS_LAST_KEY" VARCHAR(55),
"TMP_MAIN_IS_LAST" BOOLEAN,
uuid,
tmp_component_uuid,
tmp_main_component_uuid,
- component_uuid,
analysis_uuid,
status,
task_type,
tmp_is_last_key,
tmp_main_is_last,
tmp_main_is_last_key,
- is_last,
- is_last_key,
submitter_uuid,
submitted_at,
worker_uuid,
#{uuid,jdbcType=VARCHAR},
#{componentUuid,jdbcType=VARCHAR},
#{mainComponentUuid,jdbcType=VARCHAR},
- #{mainComponentUuid,jdbcType=VARCHAR},
#{analysisUuid,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{taskType,jdbcType=VARCHAR},
#{isLastKey,jdbcType=VARCHAR},
#{mainIsLast,jdbcType=BOOLEAN},
#{mainIsLastKey,jdbcType=VARCHAR},
- #{mainIsLast,jdbcType=BOOLEAN},
- #{mainIsLastKey,jdbcType=VARCHAR},
#{submitterUuid,jdbcType=VARCHAR},
#{submittedAt,jdbcType=BIGINT},
#{workerUuid,jdbcType=VARCHAR},
update ce_activity set
tmp_is_last=${_false},
tmp_main_is_last=${_false},
- is_last=${_false},
updated_at=#{updatedAt,jdbcType=BIGINT}
where
(tmp_is_last=${_true} and tmp_is_last_key=#{isLastKey,jdbcType=VARCHAR})
uuid,
task_type,
tmp_component_uuid,
- component_uuid,
tmp_main_component_uuid,
status,
submitter_uuid,
#{taskType,jdbcType=VARCHAR},
#{componentUuid,jdbcType=VARCHAR},
#{mainComponentUuid,jdbcType=VARCHAR},
- #{mainComponentUuid,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{submitterUuid,jdbcType=VARCHAR},
0,
dbSession.commit();
assertThat(db.countRowsOfTable("ce_queue")).isEqualTo(1);
- assertThat(db.countSql("select count(*) from ce_queue where component_uuid='" + projectToBeDeleted.uuid() + "'")).isEqualTo(0);
+ assertThat(db.countSql("select count(*) from ce_queue where tmp_main_component_uuid='" + projectToBeDeleted.uuid() + "'")).isEqualTo(0);
}
@Test
.add(2308, "Populate CE_ACTIVITY.MAIN_COMPONENT_UUID 2/5", PopulateTmpColumnsToCeActivity.class)
.add(2309, "Add CE_ACTIVITY.MAIN_LAST_KEY 1/6", AddTmpLastKeyColumnsToCeActivity.class)
.add(2310, "Populate CE_ACTIVITY.MAIN_LAST_KEY 2/6", PopulateTmpLastKeyColumnsToCeActivity.class)
+ .add(2311, "Populate CE_ACTIVITY.MAIN_LAST_KEY 3/6", MakeCeActivityLastKeyColumnsNullable.class)
;
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.v74;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.SupportsBlueGreen;
+import org.sonar.server.platform.db.migration.def.BooleanColumnDef;
+import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
+import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
+
+@SupportsBlueGreen
+public class MakeCeActivityLastKeyColumnsNullable extends DdlChange {
+ private static final BooleanColumnDef COLUMN_IS_LAST = newBooleanColumnDefBuilder()
+ .setColumnName("is_last")
+ .setIsNullable(true)
+ .build();
+ private static final VarcharColumnDef COLUMN_IS_LAST_KEY = newVarcharColumnDefBuilder()
+ .setColumnName("is_last_key")
+ .setLimit(55)
+ .setIsNullable(true)
+ .build();
+
+ public MakeCeActivityLastKeyColumnsNullable(Database db) {
+ super(db);
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ context.execute(new AlterColumnsBuilder(getDialect(), "ce_activity")
+ .updateColumn(COLUMN_IS_LAST)
+ .updateColumn(COLUMN_IS_LAST_KEY)
+ .build());
+ }
+}
@Test
public void verify_migration_count() {
- verifyMigrationCount(underTest, 11);
+ verifyMigrationCount(underTest, 12);
}
}