@Test public void addPresentedColumn() throws Exception { SourceKey tableKey = new SourceKey(meta.getTableName()); com.fr.swift.db.Table table = SwiftDatabase.getInstance().createTable(tableKey, meta); new AddColumnAction(new MetaDataColumnEntity("i", Types.VARCHAR)).alter(table); table = SwiftDatabase.getInstance().getTable(tableKey); Assert.assertEquals(1, table.getMeta().getColumnCount()); }
@Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); @Override void alter(Table table); }
AddColumnAction extends BaseAlterTableAction { @Override public void alter(Table table) { if (existsColumn(table.getMetadata())) { SwiftLoggers.getLogger().warn("column {} exists in {}, will add nothing", relatedColumnMeta, table); return; } SwiftLoggers.getLogger().info("add column {} to {}", relatedColumnMeta, table); alterMeta(table); } AddColumnAction(SwiftMetaDataColumn relatedColumnMeta); @Override void alter(Table table);  }