Search in sources :

Example 1 with CreateProcedureChange

use of liquibase.change.core.CreateProcedureChange in project quarkus by quarkusio.

the class LiquibaseMongodbProcessor method extractChangeFile.

private Optional<String> extractChangeFile(Change change, String changeSetFilePath) {
    String path = null;
    Boolean relative = null;
    if (change instanceof LoadDataChange) {
        LoadDataChange loadDataChange = (LoadDataChange) change;
        path = loadDataChange.getFile();
        relative = loadDataChange.isRelativeToChangelogFile();
    } else if (change instanceof SQLFileChange) {
        SQLFileChange sqlFileChange = (SQLFileChange) change;
        path = sqlFileChange.getPath();
        relative = sqlFileChange.isRelativeToChangelogFile();
    } else if (change instanceof CreateProcedureChange) {
        CreateProcedureChange createProcedureChange = (CreateProcedureChange) change;
        path = createProcedureChange.getPath();
        relative = createProcedureChange.isRelativeToChangelogFile();
    } else if (change instanceof CreateViewChange) {
        CreateViewChange createViewChange = (CreateViewChange) change;
        path = createViewChange.getPath();
        relative = createViewChange.getRelativeToChangelogFile();
    }
    // unrelated change or change does not reference a file (e.g. inline view)
    if (path == null) {
        return Optional.empty();
    }
    // absolute file path or changeSet has no file path
    if (relative == null || !relative || changeSetFilePath == null) {
        return Optional.of(path);
    }
    // notes: ClassLoaderResourceAccessor does not provide a suitable method and CLRA.getFinalPath() is not visible
    return Optional.of(Paths.get(changeSetFilePath).resolveSibling(path).toString().replace('\\', '/'));
}
Also used : SQLFileChange(liquibase.change.core.SQLFileChange) CreateViewChange(liquibase.change.core.CreateViewChange) CreateProcedureChange(liquibase.change.core.CreateProcedureChange) LoadDataChange(liquibase.change.core.LoadDataChange)

Example 2 with CreateProcedureChange

use of liquibase.change.core.CreateProcedureChange in project seed by euu-rocks.

the class DBObjectChangeLogBuilder method addCreateProcedureChange.

private void addCreateProcedureChange(DBObject dbObject) {
    final CreateProcedureChange createProcedureChange = new CreateProcedureChange();
    createProcedureChange.setEncoding(StreamUtils.CHARSET.name());
    createProcedureChange.setProcedureName(dbObject.getInternalName());
    createProcedureChange.setProcedureText(dbObject.getContent());
    addChange(createProcedureChange);
}
Also used : CreateProcedureChange(liquibase.change.core.CreateProcedureChange)

Example 3 with CreateProcedureChange

use of liquibase.change.core.CreateProcedureChange in project quarkus by quarkusio.

the class LiquibaseProcessor method extractChangeFile.

private Optional<String> extractChangeFile(Change change, String changeSetFilePath) {
    String path = null;
    Boolean relative = null;
    if (change instanceof LoadDataChange) {
        LoadDataChange loadDataChange = (LoadDataChange) change;
        path = loadDataChange.getFile();
        relative = loadDataChange.isRelativeToChangelogFile();
    } else if (change instanceof SQLFileChange) {
        SQLFileChange sqlFileChange = (SQLFileChange) change;
        path = sqlFileChange.getPath();
        relative = sqlFileChange.isRelativeToChangelogFile();
    } else if (change instanceof CreateProcedureChange) {
        CreateProcedureChange createProcedureChange = (CreateProcedureChange) change;
        path = createProcedureChange.getPath();
        relative = createProcedureChange.isRelativeToChangelogFile();
    } else if (change instanceof CreateViewChange) {
        CreateViewChange createViewChange = (CreateViewChange) change;
        path = createViewChange.getPath();
        relative = createViewChange.getRelativeToChangelogFile();
    }
    // unrelated change or change does not reference a file (e.g. inline view)
    if (path == null) {
        return Optional.empty();
    }
    // absolute file path or changeSet has no file path
    if (relative == null || !relative || changeSetFilePath == null) {
        return Optional.of(path);
    }
    // notes: ClassLoaderResourceAccessor does not provide a suitable method and CLRA.getFinalPath() is not visible
    return Optional.of(Paths.get(changeSetFilePath).resolveSibling(path).toString().replace('\\', '/'));
}
Also used : SQLFileChange(liquibase.change.core.SQLFileChange) CreateViewChange(liquibase.change.core.CreateViewChange) CreateProcedureChange(liquibase.change.core.CreateProcedureChange) LoadDataChange(liquibase.change.core.LoadDataChange)

Aggregations

CreateProcedureChange (liquibase.change.core.CreateProcedureChange)3 CreateViewChange (liquibase.change.core.CreateViewChange)2 LoadDataChange (liquibase.change.core.LoadDataChange)2 SQLFileChange (liquibase.change.core.SQLFileChange)2