Package liquibase.change.core

Examples of liquibase.change.core.CreateIndexChange


        createTableChange.setTableName(usedTableName);

        createTableChange.addColumn(new ColumnConfig().setName("name").setType("varchar(255)").setConstraints(new ConstraintsConfig().setNullable(false)));
        createTableChange.addColumn(new ColumnConfig().setName("other_column").setType("int"));

        CreateIndexChange createIndexChange = new CreateIndexChange();
        createIndexChange.setIndexName(change.getIndexName());
        createIndexChange.setTableName(usedTableName);
        createIndexChange.addColumn((AddColumnConfig) new AddColumnConfig().setName("name"));

        return new Change[] {createTableChange, createIndexChange };

    }
View Full Code Here


        DropIndexChange dropIndexChange = new DropIndexChange();
        dropIndexChange.setTableName(index.getTable().getName());
        dropIndexChange.setIndexName(index.getName());
       
        CreateIndexChange addIndexChange = new CreateIndexChange();
        addIndexChange.setTableName(index.getTable().getName());
        List<AddColumnConfig> columns = new ArrayList<AddColumnConfig>();
        for (Column col : index.getColumns()) {
            columns.add(new AddColumnConfig(col));
        }
        addIndexChange.setColumns(columns);
        addIndexChange.setIndexName(index.getName());


        if (control.getIncludeCatalog()) {
            dropIndexChange.setCatalogName(index.getSchema().getCatalogName());
            addIndexChange.setCatalogName(index.getSchema().getCatalogName());
        }
        if (control.getIncludeSchema()) {
            dropIndexChange.setSchemaName(index.getSchema().getName());
            addIndexChange.setSchemaName(index.getSchema().getName());
        }

        Difference columnsDifference = differences.getDifference("columns");
       
        if (columns != null) {
View Full Code Here

    @Override
    public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl control, Database referenceDatabase, Database comparisonDatabase, ChangeGeneratorChain chain) {
        Index index = (Index) missingObject;

        CreateIndexChange change = createCreateIndexChange();
        change.setTableName(index.getTable().getName());
        if (control.getIncludeTablespace()) {
            change.setTablespace(index.getTablespace());
        }
        if (control.getIncludeCatalog()) {
            change.setCatalogName(index.getTable().getSchema().getCatalogName());
        }
        if (control.getIncludeSchema()) {
            change.setSchemaName(index.getTable().getSchema().getName());
        }
        change.setIndexName(index.getName());
        change.setUnique(index.isUnique());
        change.setAssociatedWith(index.getAssociatedWithAsString());
        change.setClustered(index.getClustered());

//        if (index.getAssociatedWith().contains(Index.MARK_PRIMARY_KEY) || index.getAssociatedWith().contains(Index.MARK_FOREIGN_KEY) || index.getAssociatedWith().contains(Index.MARK_UNIQUE_CONSTRAINT)) {
//            continue;
//        }

        for (Column column : index.getColumns()) {
            change.addColumn(new AddColumnConfig(column));
        }

        return new Change[] { change };
    }
View Full Code Here

        return new Change[] { change };
    }

    protected CreateIndexChange createCreateIndexChange() {
        return new CreateIndexChange();
    }
View Full Code Here

TOP

Related Classes of liquibase.change.core.CreateIndexChange

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.