use of liquibase.database.core.HsqlDatabase in project liquibase by liquibase.
the class TagDatabaseGeneratorTest method testHsql.
@Test
public void testHsql() throws Exception {
TagDatabaseStatement statement = new TagDatabaseStatement("v1.0");
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, new HsqlDatabase());
assertEquals(1, sql.length);
assertEquals("UPDATE DATABASECHANGELOG " + "SET TAG = 'v1.0' " + "WHERE DATEEXECUTED = (" + "SELECT MAX(DATEEXECUTED) " + "FROM DATABASECHANGELOG" + ")", sql[0].toSql());
}
use of liquibase.database.core.HsqlDatabase in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementStartWithIncrementByHsqlDatabase.
@Test
public void testAutoIncrementStartWithIncrementByHsqlDatabase() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof HsqlDatabase) {
CreateTableStatement statement = new CreateTableStatement(CATALOG_NAME, SCHEMA_NAME, TABLE_NAME);
statement.addColumn(COLUMN_NAME1, DataTypeFactory.getInstance().fromDescription("BIGINT{autoIncrement:true}", database), new AutoIncrementConstraint(COLUMN_NAME1, BigInteger.ONE, BigInteger.TEN));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
assertEquals("CREATE TABLE SCHEMA_NAME.TABLE_NAME (COLUMN1_NAME BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 10))", generatedSql[0].toSql());
}
}
}
use of liquibase.database.core.HsqlDatabase in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementStartWithHsqlDatabase.
@Test
public void testAutoIncrementStartWithHsqlDatabase() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof HsqlDatabase) {
CreateTableStatement statement = new CreateTableStatement(CATALOG_NAME, SCHEMA_NAME, TABLE_NAME);
statement.addColumn(COLUMN_NAME1, DataTypeFactory.getInstance().fromDescription("BIGINT{autoIncrement:true}", database), new AutoIncrementConstraint(COLUMN_NAME1, BigInteger.ONE, null));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
assertEquals("CREATE TABLE SCHEMA_NAME.TABLE_NAME (COLUMN1_NAME BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1))", generatedSql[0].toSql());
}
}
}
Aggregations