Package liquibase.change.core

Examples of liquibase.change.core.AddUniqueConstraintChange


        if (uc.getTable() == null) {
            return null;
        }

        AddUniqueConstraintChange change = new AddUniqueConstraintChange();
        change.setTableName(uc.getTable().getName());
        if (uc.getBackingIndex() != null && control.getIncludeTablespace()) {
            change.setTablespace(uc.getBackingIndex().getTablespace());
        }
        if (control.getIncludeCatalog()) {
            change.setCatalogName(uc.getTable().getSchema().getCatalogName());
        }
        if (control.getIncludeSchema()) {
            change.setSchemaName(uc.getTable().getSchema().getName());
        }
        change.setConstraintName(uc.getName());
        change.setColumnNames(uc.getColumnNames());
        change.setDeferrable(uc.isDeferrable());
        change.setInitiallyDeferred(uc.isInitiallyDeferred());
        change.setDisabled(uc.isDisabled());

        Index backingIndex = uc.getBackingIndex();
//        if (backingIndex == null) {
//            Index exampleIndex = new Index().setTable(uc.getTable());
//            for (String col : uc.getColumns()) {
View Full Code Here


        for (String column : uniqueColumns.split(",")) {
            createTableChange.addColumn(new ColumnConfig().setName(column.trim()).setType("int").setConstraints(new ConstraintsConfig().setNullable(false)));
        }
        createTableChange.addColumn(new ColumnConfig().setName("other_column").setType("int"));

        AddUniqueConstraintChange addUniqueConstraintChange = new AddUniqueConstraintChange();
        addUniqueConstraintChange.setCatalogName(change.getCatalogName());
        addUniqueConstraintChange.setSchemaName(change.getSchemaName());
        addUniqueConstraintChange.setTableName(change.getTableName());
        addUniqueConstraintChange.setColumnNames(uniqueColumns);
        addUniqueConstraintChange.setConstraintName(change.getConstraintName());

        return new Change[] {createTableChange, addUniqueConstraintChange };
    }
View Full Code Here

TOP

Related Classes of liquibase.change.core.AddUniqueConstraintChange

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.