use of liquibase.database.core.CockroachDatabase in project liquibase by liquibase.
the class AlterSequenceGeneratorTest method testAlterSequenceCycleDatabase.
// @Test
// public void h2DatabaseSupportsSequenceMaxValue() throws Exception {
//
// H2Database h2Database = new H2Database();
// h2Database.setConnection(mockedSupportedMinMaxSequenceConnection);
//
// AlterSequenceStatement alterSequenceStatement = createSampleSqlStatement();
// alterSequenceStatement.setMaxValue(new BigInteger("1000"));
//
// assertFalse(generatorUnderTest.validate(alterSequenceStatement, h2Database, new MockSqlGeneratorChain()).hasErrors());
// }
// @Test
// public void h2DatabaseDoesNotSupportsSequenceMaxValue() throws Exception {
//
// H2Database h2Database = new H2Database();
// h2Database.setConnection(mockedUnsupportedMinMaxSequenceConnection);
//
// AlterSequenceStatement alterSequenceStatement = createSampleSqlStatement();
// alterSequenceStatement.setMaxValue(new BigInteger("1000"));
//
// assertTrue(generatorUnderTest.validate(alterSequenceStatement, h2Database, new MockSqlGeneratorChain()).hasErrors());
// }
// @Test
// public void h2DatabaseSupportsSequenceMinValue() throws Exception {
//
// H2Database h2Database = new H2Database();
// h2Database.setConnection(mockedSupportedMinMaxSequenceConnection);
//
// AlterSequenceStatement alterSequenceStatement = createSampleSqlStatement();
// alterSequenceStatement.setMinValue(new BigInteger("10"));
//
// assertFalse(generatorUnderTest.validate(alterSequenceStatement, h2Database, new MockSqlGeneratorChain()).hasErrors());
// }
//
// @Test
// public void h2DatabaseDoesNotSupportsSequenceMinValue() throws Exception {
//
// H2Database h2Database = new H2Database();
// h2Database.setConnection(mockedUnsupportedMinMaxSequenceConnection);
//
// AlterSequenceStatement alterSequenceStatement = createSampleSqlStatement();
// alterSequenceStatement.setMinValue(new BigInteger("10"));
//
// assertTrue(generatorUnderTest.validate(alterSequenceStatement, h2Database, new MockSqlGeneratorChain()).hasErrors());
// }
@Test
public void testAlterSequenceCycleDatabase() {
for (Database database : TestContext.getInstance().getAllDatabases()) {
AlterSequenceStatement statement = createSampleSqlStatement();
statement.setCycle(false);
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
if (database instanceof OracleDatabase) {
assertEquals("ALTER SEQUENCE CATALOG_NAME.SEQUENCE_NAME NOCYCLE", generatedSql[0].toSql());
} else if (database instanceof PostgresDatabase || database instanceof CockroachDatabase) {
assertEquals("ALTER SEQUENCE SCHEMA_NAME.SEQUENCE_NAME NO CYCLE", generatedSql[0].toSql());
}
}
}
Aggregations