use of liquibase.statement.core.CreateTableStatement in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementStartWithDerbyDatabase.
@Test
public void testAutoIncrementStartWithDerbyDatabase() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof DerbyDatabase) {
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.ZERO, null));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
assertEquals("CREATE TABLE CATALOG_NAME.TABLE_NAME (COLUMN1_NAME BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 0))", generatedSql[0].toSql());
}
}
}
use of liquibase.statement.core.CreateTableStatement in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementDB2Database.
@Test
public void testAutoIncrementDB2Database() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof AbstractDb2Database) {
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));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
assertEquals("CREATE TABLE \"CATALOG_NAME\".TABLE_NAME (COLUMN1_NAME BIGINT GENERATED BY DEFAULT AS IDENTITY)", generatedSql[0].toSql());
}
}
}
use of liquibase.statement.core.CreateTableStatement in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementStartWithIncrementByMySQLDatabase.
@Test
public void testAutoIncrementStartWithIncrementByMySQLDatabase() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof MySQLDatabase) {
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.valueOf(2), BigInteger.TEN));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
// increment by not supported by MySQL
assertEquals("CREATE TABLE CATALOG_NAME.TABLE_NAME (COLUMN1_NAME BIGINT AUTO_INCREMENT NULL) AUTO_INCREMENT=2", generatedSql[0].toSql());
}
}
}
use of liquibase.statement.core.CreateTableStatement in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementStartWithSybaseASADatabase.
@Test
public void testAutoIncrementStartWithSybaseASADatabase() throws Exception {
for (Database database : TestContext.getInstance().getAllDatabases()) {
if (database instanceof SybaseASADatabase) {
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.valueOf(2), null));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
// start with not supported by SybaseASA
assertEquals("CREATE TABLE SCHEMA_NAME.TABLE_NAME (COLUMN1_NAME BIGINT DEFAULT AUTOINCREMENT NULL)", generatedSql[0].toSql());
}
}
}
use of liquibase.statement.core.CreateTableStatement in project liquibase by liquibase.
the class CreateTableGeneratorTest method testAutoIncrementHsqlDatabase.
@Test
public void testAutoIncrementHsqlDatabase() 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));
Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
assertEquals("CREATE TABLE SCHEMA_NAME.TABLE_NAME (COLUMN1_NAME BIGINT GENERATED BY DEFAULT AS IDENTITY)", generatedSql[0].toSql());
}
}
}
Aggregations