本文整理汇总了Java中liquibase.database.Database.getDefaultSchemaName方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getDefaultSchemaName方法的具体用法?Java Database.getDefaultSchemaName怎么用?Java Database.getDefaultSchemaName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liquibase.database.Database
的用法示例。
在下文中一共展示了Database.getDefaultSchemaName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ChangeSet changeSet = statement.getChangeSet();
String tmpTable = UUID.randomUUID().toString().replaceAll("-", "");
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogTableName();
CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(database.escapeObjectName("ID", Column.class) + " != ? " +
"AND " + database.escapeObjectName("FILENAME", Column.class) + " != ?")
.addWhereParameters(changeSet.getId(), changeSet.getFilePath());
return CustomSqlGenerator.generateSql(database,
createTableAsSelectStatement,
new DropTableStatement(catalogName, schemaName, tableName, false),
new RenameTableStatement(catalogName, schemaName, tmpTable, tableName));
}
示例2: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(TagDatabaseStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogTableName();
String tableNameEscaped = database.escapeObjectName(tableName, Table.class);
String dateColumnNameEscaped = database.escapeObjectName("DATEEXECUTED", Column.class);
String tagColumnNameEscaped = database.escapeObjectName("TAG", Column.class);
String tempTable = UUID.randomUUID().toString().replaceAll("-", "");
CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tempTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(tableNameEscaped + "." + dateColumnNameEscaped + " NOT IN (SELECT MAX(" + tableNameEscaped + "." + dateColumnNameEscaped + ") " +
"FROM " + tableNameEscaped + ")");
InsertAsSelectStatement insertAsSelectStatement = new InsertAsSelectStatement(catalogName, schemaName, tableName, tempTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "'" + statement.getTag() + "'", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(tableNameEscaped + "." + dateColumnNameEscaped + " IN (SELECT MAX(" + tableNameEscaped + "." + dateColumnNameEscaped + ") FROM " + tableNameEscaped + ") AND ("
+ tableNameEscaped + "." + tagColumnNameEscaped + " IS NULL OR " + tableNameEscaped + "." + tagColumnNameEscaped + " != ?)").addWhereParameters(statement.getTag());
return CustomSqlGenerator.generateSql(database,
createTableAsSelectStatement,
insertAsSelectStatement,
new DropTableStatement(catalogName, schemaName, tableName, false),
new RenameTableStatement(catalogName, schemaName, tempTable, tableName));
}
示例3: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ChangeSet changeSet = statement.getChangeSet();
String tmpTable = UUID.randomUUID().toString().replaceAll("-", "");
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogTableName();
CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(" NOT (" + database.escapeObjectName("ID", Column.class) + " = ? " +
"AND " + database.escapeObjectName("FILENAME", Column.class) + " = ?)")
.addWhereParameters(changeSet.getId(), changeSet.getFilePath());
return CustomSqlGenerator.generateSql(database,
UserSessionSettings.syncDdlStart(),
createTableAsSelectStatement,
new DropTableStatement(catalogName, schemaName, tableName, false),
new RenameTableStatement(catalogName, schemaName, tmpTable, tableName),
UserSessionSettings.syncDdlStop());
}
示例4: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName)
.addColumnValue("ID", 1)
.addColumnValue("LOCKED", Boolean.TRUE)
.addColumnValue("LOCKEDBY", hostname + " [" + hostaddress + "]")
.addColumnValue("LOCKGRANTED", DateTimeUtils.getCurrentTS("yyyy-MM-dd HH:mm:ss"));
return CustomSqlGenerator.generateSql(database,
UserSessionSettings.syncDdlStart(),
new TruncateTableStatement(catalogName, schemaName, tableName),
insertStatement,
UserSessionSettings.syncDdlStop());
}
示例5: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
HiveInsertStatement hiveInsertStatement = new HiveInsertStatement(catalogName, schemaName, tableName);
hiveInsertStatement.addColumnValue(1);
hiveInsertStatement.addColumnValue(Boolean.TRUE);
hiveInsertStatement.addColumnValue(hostname + " (" + hostaddress + ")");
hiveInsertStatement.addColumnValue(DateTimeUtils.getCurrentTS("yyyy-MM-dd HH:mm:ss"));
return CustomSqlGenerator.generateSql(database,
new TruncateTableStatement(catalogName, schemaName, tableName),
hiveInsertStatement);
}
示例6: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(UnlockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
HiveInsertStatement hiveInsertStatement = new HiveInsertStatement(catalogName, schemaName, tableName)
.addColumnValue(1)
.addColumnValue(Boolean.FALSE)
.addColumnValue("NULL")
.addColumnValue("NULL");
return CustomSqlGenerator.generateSql(database,
new TruncateTableStatement(catalogName, schemaName, tableName),
hiveInsertStatement);
}
示例7: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(InitializeDatabaseChangeLogLockTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
HiveInsertStatement insertStatementHive = new HiveInsertStatement(catalogName, schemaName, tableName)
.addColumnValue(1)
.addColumnValue(Boolean.FALSE)
.addColumnValue("NULL")
.addColumnValue("NULL");
return CustomSqlGenerator.generateSql(database,
new TruncateTableStatement(catalogName, schemaName, tableName),
insertStatementHive);
}
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:16,代码来源:HiveInitializeDatabaseChangeLogLockTableGenerator.java
示例8: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(InitializeDatabaseChangeLogLockTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName)
.addColumnValue("ID", 1)
.addColumnValue("LOCKED", Boolean.FALSE);
return CustomSqlGenerator.generateSql(database,
UserSessionSettings.syncDdlStart(),
new TruncateTableStatement(catalogName, schemaName, tableName),
insertStatement,
UserSessionSettings.syncDdlStop());
}
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:16,代码来源:ImpalaInitializeDatabaseChangeLogLockTableGenerator.java
示例9: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(TagDatabaseStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogTableName();
String tableNameEscaped = database.escapeTableName(catalogName, schemaName, tableName);
String dateColumnNameEscaped = database.escapeObjectName("DATEEXECUTED", Column.class);
String tagColumnNameEscaped = database.escapeObjectName("TAG", Column.class);
String tmpTable = UUID.randomUUID().toString().replaceAll("-", "");
CreateTableAsSelectStatement createTableAsSelectStatement = new CreateTableAsSelectStatement(catalogName, schemaName, tableName, tmpTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "TAG", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(dateColumnNameEscaped + " != (SELECT MAX(" + dateColumnNameEscaped + ") " +
"FROM " + tableNameEscaped + ")");
InsertAsSelectStatement insertAsSelectStatement = new InsertAsSelectStatement(database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName(), tmpTable)
.addColumnNames("ID", "AUTHOR", "FILENAME", "DATEEXECUTED", "ORDEREXECUTED", "EXECTYPE", "MD5SUM", "DESCRIPTION", "COMMENTS", "'" + statement.getTag() + "'", "LIQUIBASE", "CONTEXTS", "LABELS", "DEPLOYMENT_ID")
.setWhereCondition(dateColumnNameEscaped + " = (SELECT MAX(" + dateColumnNameEscaped + ") FROM " + tableNameEscaped + ") AND ("
+ tagColumnNameEscaped + " IS NULL OR " + tagColumnNameEscaped + " != ?)")
.addWhereParameters(statement.getTag());
return CustomSqlGenerator.generateSql(database,
UserSessionSettings.syncDdlStart(),
createTableAsSelectStatement,
insertAsSelectStatement,
new DropTableStatement(catalogName, schemaName, tableName, false),
new RenameTableStatement(catalogName, schemaName, tmpTable, tableName),
UserSessionSettings.syncDdlStop());
}
示例10: generateSql
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public Sql[] generateSql(UnlockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String catalogName = database.getLiquibaseCatalogName();
String schemaName = database.getDefaultSchemaName();
String tableName = database.getDatabaseChangeLogLockTableName();
InsertStatement insertStatement = new InsertStatement(catalogName, schemaName, tableName)
.addColumnValue("ID", 1)
.addColumnValue("LOCKED", Boolean.FALSE);
return CustomSqlGenerator.generateSql(database,
UserSessionSettings.syncDdlStart(),
new TruncateTableStatement(catalogName, schemaName, tableName),
insertStatement,
UserSessionSettings.syncDdlStop());
}
示例11: subscribeTenant
import liquibase.database.Database; //导入方法依赖的package包/类
@Override
public void subscribeTenant(final String tenantId) {
String defaultSchemaName;
try {
Validate.isTrue(isValidTenantId(tenantId), String.format("Invalid tenant id: \"%s\"", tenantId));
final String schemaName = TenantUtil.createSchemaName(tenantId);
final Connection connection = dataSource.getConnection();
final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
try (Statement statement = connection.createStatement()) {
statement.execute(String.format("CREATE SCHEMA IF NOT EXISTS \"%s\"", schemaName));
connection.commit();
defaultSchemaName = database.getDefaultSchemaName();
database.setDefaultSchemaName(schemaName);
final String filePath = LIQUIBASE_PATH;
final Liquibase liquibase = new liquibase.Liquibase(filePath,
new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());
database.setDefaultSchemaName(defaultSchemaName);
}
} catch (SQLException | LiquibaseException | IllegalArgumentException e) {
final BadRequestException badRequestException = new BadRequestException();
logger.error("Tenant subscription failed for {}.", tenantId, e);
throw badRequestException;
}
}