@Test void generate() { Database database = TestDatabase.testDatabaseBuilder() .defaultSqlExecutor(JdbcSqlExecutor.of(dataSource())) .dialect(new H2Dialect()) .build(); SchemaGenerator schemaGenerator = new SchemaGenerator(true); schemaGenerator.generate(database, TestSchema::schemaDefinition); schemaGenerator.generate(database, TestSchema::schemaDefinition); SalespersonRow salespersonRow = aRandomSalesperson(); database.insert(salespersonRow); }
public void generate(Database database, SchemaDefinition schemaDefinition) { if (dropFirst) { long dropped = dropAll(database); LOG.debug("Dropped {} objects", dropped); } Stream<Action> actions = Stream.concat( Stream.of(new CreateActionLogTable(database.defaultCatalog(), database.defaultSchema())), schemaDefinition.actions()); long count = pipeline .process(database, actions) .count(); LOG.debug("Processed {} actions", count); }
SchemaGenerator { public void generate(Database database, SchemaDefinition schemaDefinition) { if (dropFirst) { long dropped = dropAll(database); LOG.debug("Dropped {} objects", dropped); } Stream<Action> actions = Stream.concat( Stream.of(new CreateActionLogTable(database.defaultCatalog(), database.defaultSchema())), schemaDefinition.actions()); long count = pipeline .process(database, actions) .count(); LOG.debug("Processed {} actions", count); } }
SchemaGenerator { public void generate(Database database, SchemaDefinition schemaDefinition) { if (dropFirst) { long dropped = dropAll(database); LOG.debug("Dropped {} objects", dropped); } Stream<Action> actions = Stream.concat( Stream.of(new CreateActionLogTable(database.defaultCatalog(), database.defaultSchema())), schemaDefinition.actions()); long count = pipeline .process(database, actions) .count(); LOG.debug("Processed {} actions", count); } SchemaGenerator(boolean dropFirst); }
SchemaGenerator { public void generate(Database database, SchemaDefinition schemaDefinition) { if (dropFirst) { long dropped = dropAll(database); LOG.debug("Dropped {} objects", dropped); } Stream<Action> actions = Stream.concat( Stream.of(new CreateActionLogTable(database.defaultCatalog(), database.defaultSchema())), schemaDefinition.actions()); long count = pipeline .process(database, actions) .count(); LOG.debug("Processed {} actions", count); } SchemaGenerator(boolean dropFirst); void generate(Database database, SchemaDefinition schemaDefinition); void generate(Database database, Function1<T,SchemaDefinition> schemaDefinition); }
SchemaGenerator { public void generate(Database database, SchemaDefinition schemaDefinition) { if (dropFirst) { long dropped = dropAll(database); LOG.debug("Dropped {} objects", dropped); } Stream<Action> actions = Stream.concat( Stream.of(new CreateActionLogTable(database.defaultCatalog(), database.defaultSchema())), schemaDefinition.actions()); long count = pipeline .process(database, actions) .count(); LOG.debug("Processed {} actions", count); } SchemaGenerator(boolean dropFirst); void generate(Database database, SchemaDefinition schemaDefinition); void generate(Database database, Function1<T,SchemaDefinition> schemaDefinition);  }