Skip to content

Commit

Permalink
SONARCLOUD-75 Mark 3 migrations as blue/green compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Brandhof authored and SonarTech committed Jun 14, 2018
1 parent ccf2766 commit df2f2c4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@

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.IntegerColumnDef;
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;

/**
* The missing unique index can be added when server is up, so
* blue/green deployment is supported.
* See {@link PurgeDuplicateRulesParameters} for more details.
*/
@SupportsBlueGreen
public class AddUniqueIndexOnRulesParameters extends DdlChange {

public AddUniqueIndexOnRulesParameters(Database db) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@

import java.sql.SQLException;
import org.sonar.db.Database;
import org.sonar.server.platform.db.migration.SupportsBlueGreen;
import org.sonar.server.platform.db.migration.step.DataChange;

/**
* The migration drops duplicated rows from some rules-related tables.
* The root cause of these duplications is not known. It could even
* be already fixed. Assuming that the duplications are not created frequently,
* nor recently, then executing the migration when server is up
* is safe. Blue/green deployment is supported.
*/
@SupportsBlueGreen
public class PurgeDuplicateRulesParameters extends DataChange {

private static final String REMOVE_DUPLICATE_RULES_PARAMS_SQL_FOR_GENERIC =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@

import java.sql.SQLException;
import org.sonar.db.Database;
import org.sonar.server.platform.db.migration.SupportsBlueGreen;
import org.sonar.server.platform.db.migration.step.DataChange;

/**
* The migration drops the orphans from tables ce_*. It can be executed
* when server is up, so it supports blue/green deployments.
*/
@SupportsBlueGreen
public class PurgeOrphansForCE extends DataChange {

public PurgeOrphansForCE(Database db) {
Expand Down

0 comments on commit df2f2c4

Please sign in to comment.