private void syncSchemaTables(DbPlatform dbPlatform, RichIterable<TableSyncSide> syncSides, File outputDir) { for (TableSyncSide syncSide : syncSides) { syncSide.enrichTables(dbPlatform); } RichIterable<DaTable> idealTables = this.createIdealTables(syncSides); MapIterable<String, DaTable> idealTablesMap = idealTables.groupByUniqueKey(DaNamedObject.TO_NAME); System.out.println("Starting the alters"); for (TableSyncSide syncSide : syncSides) { for (DaTable table : syncSide.getTables()) { File outputFile = new File(new File(outputDir, syncSide.getSchema().getPhysicalName()), table.getName() + ".sql"); this.generateDiffsToTable(table, idealTablesMap.get(table.getName()), outputFile); } } }
private void syncSchemaTables(DbPlatform dbPlatform, RichIterable<TableSyncSide> syncSides, File outputDir) { for (TableSyncSide syncSide : syncSides) { syncSide.enrichTables(dbPlatform); } RichIterable<DaTable> idealTables = this.createIdealTables(syncSides); MapIterable<String, DaTable> idealTablesMap = idealTables.groupByUniqueKey(DaNamedObject.TO_NAME); System.out.println("Starting the alters"); for (TableSyncSide syncSide : syncSides) { for (DaTable table : syncSide.getTables()) { File outputFile = new File(new File(outputDir, syncSide.getSchema().getPhysicalName()), table.getName() + ".sql"); this.generateDiffsToTable(table, idealTablesMap.get(table.getName()), outputFile); } } }
private static ImmutableCollection<DaTable> getTables(DbPlatform dbPlatform, TableSyncSide side) { DbMetadataManager metadataManager = dbPlatform.getDbMetadataManager(); metadataManager.setDataSource(side.getDataSource()); DaCatalog database = metadataManager.getDatabase(side.getSchema(), new DaSchemaInfoLevel().setRetrieveTableAndColumnDetails(), true, false); return database.getTables().reject(DaTable.IS_VIEW); }
private static ImmutableCollection<DaTable> getTables(DbPlatform dbPlatform, TableSyncSide side) { DbMetadataManager metadataManager = dbPlatform.getDbMetadataManager(); metadataManager.setDataSource(side.getDataSource()); DaCatalog database = metadataManager.getDatabase(side.getSchema(), new DaSchemaInfoLevel().setRetrieveTableAndColumnDetails(), true, false); return database.getTables().reject(DaTable.IS_VIEW); }