/** * @param sourceTableDef * @param ddlDialect * @return */ @Override public AlterTableDDLBuilder newInstance(TableDef sourceTable, DDLDialect ddlDialect) { AssertUtils.notNull(ddlDialect, "ddlDialect is null."); AssertUtils.notNull(sourceTable, "sourceTable is null."); AssertUtils.notEmpty(sourceTable.getTableName(), "sourceTable.tableName is empty."); AssertUtils.notEmpty(sourceTable.getColumns(), "sourceTable.columns is empty."); MysqlAlterTableDDLBuilder builder = new MysqlAlterTableDDLBuilder(sourceTable, ddlDialect); return builder; }
/** * @param newTableDef * @param sourceTableDef * @param ddlDialect * @return */ @Override public AlterTableDDLBuilder newInstance( TableDef newTable, TableDef sourceTable, DDLDialect ddlDialect) { AssertUtils.notNull(ddlDialect, "ddlDialect is null."); AssertUtils.notNull(newTable, "newTable is null."); AssertUtils.notEmpty(newTable.getTableName(), "newTable.tableName is empty."); AssertUtils.notNull(sourceTable, "sourceTable is null."); AssertUtils.notEmpty(sourceTable.getTableName(), "sourceTable.tableName is empty."); AssertUtils.isTrue( newTable.getTableName().equalsIgnoreCase(sourceTable.getTableName()), "newTable.tableName:{} should equalsIgnoreCase sourceTable.tableName:{}", new Object[] {newTable.getTableName(), sourceTable.getTableName()}); MysqlAlterTableDDLBuilder builder = new MysqlAlterTableDDLBuilder(newTable, sourceTable, ddlDialect); this.columns.addAll(newTable.getColumns()); this.indexes.addAll(newTable.getIndexes()); return builder; }