*/
public static final int MIN_UPGRADE_VERSION = 1152;
+ /**
+ * These tables are still involved in DB migrations, so potentially
+ * incorrect collation must be fixed so that joins with other
+ * tables are possible.
+ *
+ * @see org.sonar.db.charset.ColumnDef#isInSonarQubeTable()
+ */
+ public static final Set<String> OLD_DROPPED_TABLES = ImmutableSet.of(
+ "activities"
+ );
+
/**
* List of all the tables.
* This list is hardcoded because we didn't succeed in using java.sql.DatabaseMetaData#getTables() in the same way
"user_tokens",
"widgets",
"widget_properties");
+
private MyBatis mybatis;
public DatabaseVersion(MyBatis mybatis) {
@Test
public void isInSonarQubeTable_returns_false_if_sqlazure_system_table() {
- ColumnDef underTest = new ColumnDef("sys.sysusers", "colum", "charset", "collation", "NVARCHAR", 100L, false);
+ ColumnDef underTest = new ColumnDef("sys.sysusers", "login", "charset", "collation", "NVARCHAR", 100L, false);
assertThat(underTest.isInSonarQubeTable()).isFalse();
- underTest = new ColumnDef("SYS.SYSUSERS", "colum", "charset", "collation", "NVARCHAR", 100L, false);
+ underTest = new ColumnDef("SYS.SYSUSERS", "login", "charset", "collation", "NVARCHAR", 100L, false);
assertThat(underTest.isInSonarQubeTable()).isFalse();
}
@Test
public void isInSonarQubeTable_returns_true_if_table_created_by_sonarqube() {
- ColumnDef underTest = new ColumnDef("project_measures", "column", "charset", "collation", "NVARCHAR", 100L, false);
+ ColumnDef underTest = new ColumnDef("project_measures", "text_value", "charset", "collation", "NVARCHAR", 100L, false);
assertThat(underTest.isInSonarQubeTable()).isTrue();
- underTest = new ColumnDef("PROJECT_MEASURES", "column", "charset", "collation", "NVARCHAR", 100L, false);
+ underTest = new ColumnDef("PROJECT_MEASURES", "text_value", "charset", "collation", "NVARCHAR", 100L, false);
+ assertThat(underTest.isInSonarQubeTable()).isTrue();
+ }
+
+ @Test
+ public void isInSonarQubeTable_returns_true_if_table_existed_in_previous_versions_of_sonarqube() {
+ ColumnDef underTest = new ColumnDef("activities", "kee", "charset", "collation", "NVARCHAR", 100L, false);
assertThat(underTest.isInSonarQubeTable()).isTrue();
}
}