Package liquibase.structure.core

Examples of liquibase.structure.core.DataType


            }
            if (referenceValue == null || compareToValue == null) {
                return false;
            }

            DataType referenceType = (DataType) referenceValue;
            DataType compareToType = (DataType) compareToValue;

            if (!referenceType.getTypeName().equalsIgnoreCase(compareToType.getTypeName())) {
                return false;
            }

            if (compareToType.toString().contains("(") && referenceType.toString().contains("(")) {
                return compareToType.toString().equalsIgnoreCase(referenceType.toString());
            } else {
                return true;
            }

View Full Code Here


        TableGenerator tableGenerator = (TableGenerator) ig;
        Table table = new Table().setName(tableGenerator.getTableName());

        Column pkColumn = new Column();
        pkColumn.setName(tableGenerator.getSegmentColumnName());
        DataType pkDataType = new DataType(PK_DATA_TYPE);
        pkDataType.setColumnSize(tableGenerator.getSegmentValueLength());
        pkColumn.setType(pkDataType);
        pkColumn.setCertainDataType(false);
        pkColumn.setRelation(table);
        table.getColumns().add(pkColumn);

        PrimaryKey primaryKey = new PrimaryKey();
        primaryKey.setName(tableGenerator.getTableName() + "PK");
        primaryKey.addColumn(0, new Column(pkColumn.getName()).setRelation(table));
        primaryKey.setTable(table);
        table.setPrimaryKey(primaryKey);

        Column valueColumn = new Column();
        valueColumn.setName(tableGenerator.getValueColumnName());
        valueColumn.setType(new DataType(VALUE_DATA_TYPE));
        valueColumn.setNullable(false);
        valueColumn.setCertainDataType(false);
        valueColumn.setRelation(table);
        table.getColumns().add(valueColumn);
View Full Code Here

            table = new Table().setName((String) tableName.get(tableGenerator));

            Column pkColumn = new Column();
            pkColumn.setName((String) pkColumnName.get(tableGenerator));
            DataType pkDataType = new DataType(PK_DATA_TYPE);
            pkDataType.setColumnSize(keySize.getInt(tableGenerator));
            pkColumn.setType(pkDataType);
            pkColumn.setCertainDataType(false);
            pkColumn.setRelation(table);
            table.getColumns().add(pkColumn);

            Column valueColumn = new Column();
            valueColumn.setName((String) valueColumnName.get(tableGenerator));
            valueColumn.setType(new DataType(VALUE_DATA_TYPE));
            valueColumn.setCertainDataType(false);
            valueColumn.setRelation(table);
            table.getColumns().add(valueColumn);

        } catch (Exception e) {
View Full Code Here

public class ColumnSnapshotGeneratorTest {

    @Test
    public void toDataType() throws DatabaseException {
        ColumnSnapshotGenerator columnSnapshotGenerator = new ColumnSnapshotGenerator();
        DataType varchar = columnSnapshotGenerator.toDataType("varchar(255)", Types.VARCHAR);
        assertEquals("varchar", varchar.getTypeName());
        assertEquals(255, varchar.getColumnSize().intValue());
        assertEquals(Types.VARCHAR, varchar.getDataTypeId().intValue());
        assertNull(varchar.getColumnSizeUnit());

        DataType intType = columnSnapshotGenerator.toDataType("integer", Types.INTEGER);
        assertEquals("integer", intType.getTypeName());

        DataType varcharChar = columnSnapshotGenerator.toDataType("varchar2(30 char)", Types.INTEGER);
        assertEquals("varchar2", varcharChar.getTypeName());
        assertEquals(30, varcharChar.getColumnSize().intValue());
        assertEquals(DataType.ColumnSizeUnit.CHAR, varcharChar.getColumnSizeUnit());

    }
View Full Code Here

TOP

Related Classes of liquibase.structure.core.DataType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.