Search in sources :

Example 6 with PostgreSql

use of org.sonar.db.dialect.PostgreSql in project sonarqube by SonarSource.

the class DropIdColumnsFromSnapshotsTest method verify_generated_sql_on_postgresql.

@Test
public void verify_generated_sql_on_postgresql() throws SQLException {
    when(database.getDialect()).thenReturn(new PostgreSql());
    DdlChange.Context context = mock(DdlChange.Context.class);
    underTest.execute(context);
    verify(context).execute("ALTER TABLE snapshots DROP COLUMN project_id, DROP COLUMN root_project_id");
}
Also used : PostgreSql(org.sonar.db.dialect.PostgreSql) DdlChange(org.sonar.server.platform.db.migration.step.DdlChange) Test(org.junit.Test)

Example 7 with PostgreSql

use of org.sonar.db.dialect.PostgreSql in project sonarqube by SonarSource.

the class DropProjectIdColumnFromMeasuresTest method verify_generated_sql_on_postgresql.

@Test
public void verify_generated_sql_on_postgresql() throws SQLException {
    when(database.getDialect()).thenReturn(new PostgreSql());
    DdlChange.Context context = mock(DdlChange.Context.class);
    underTest.execute(context);
    verify(context).execute("ALTER TABLE project_measures DROP COLUMN project_id");
}
Also used : PostgreSql(org.sonar.db.dialect.PostgreSql) DdlChange(org.sonar.server.platform.db.migration.step.DdlChange) Test(org.junit.Test)

Example 8 with PostgreSql

use of org.sonar.db.dialect.PostgreSql in project sonarqube by SonarSource.

the class DropRememberMeColumnsFromUsersTest method verify_generated_sql_on_postgresql.

@Test
public void verify_generated_sql_on_postgresql() throws SQLException {
    when(database.getDialect()).thenReturn(new PostgreSql());
    DdlChange.Context context = mock(DdlChange.Context.class);
    underTest.execute(context);
    verify(context).execute("ALTER TABLE users DROP COLUMN remember_token, DROP COLUMN remember_token_expires_at");
}
Also used : PostgreSql(org.sonar.db.dialect.PostgreSql) DdlChange(org.sonar.server.platform.db.migration.step.DdlChange) Test(org.junit.Test)

Example 9 with PostgreSql

use of org.sonar.db.dialect.PostgreSql in project sonarqube by SonarSource.

the class DropIndexBuilderTest method drop_index_in_table.

@Test
public void drop_index_in_table() {
    verifySql(new H2(), "DROP INDEX IF EXISTS issues_key");
    verifySql(new MsSql(), "DROP INDEX issues_key ON issues");
    verifySql(new MySql(), "DROP INDEX issues_key ON issues");
    verifySql(new Oracle(), "DROP INDEX issues_key");
    verifySql(new PostgreSql(), "DROP INDEX IF EXISTS issues_key");
}
Also used : PostgreSql(org.sonar.db.dialect.PostgreSql) MySql(org.sonar.db.dialect.MySql) H2(org.sonar.db.dialect.H2) MsSql(org.sonar.db.dialect.MsSql) Oracle(org.sonar.db.dialect.Oracle) Test(org.junit.Test)

Example 10 with PostgreSql

use of org.sonar.db.dialect.PostgreSql in project sonarqube by SonarSource.

the class DropTableBuilderTest method fail_when_table_is_null.

@Test
public void fail_when_table_is_null() throws Exception {
    expectedException.expect(NullPointerException.class);
    new DropTableBuilder(new PostgreSql(), null);
}
Also used : PostgreSql(org.sonar.db.dialect.PostgreSql) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)19 PostgreSql (org.sonar.db.dialect.PostgreSql)19 DdlChange (org.sonar.server.platform.db.migration.step.DdlChange)10 H2 (org.sonar.db.dialect.H2)7 MsSql (org.sonar.db.dialect.MsSql)7 MySql (org.sonar.db.dialect.MySql)7 Oracle (org.sonar.db.dialect.Oracle)7