Skip to content

Commit

Permalink
0003863: DbFill cascade and select handle composite and self-referencing
Browse files Browse the repository at this point in the history
foreign key
  • Loading branch information
erilong committed Jan 25, 2019
1 parent a30c716 commit ae60f82
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 244 deletions.
3 changes: 2 additions & 1 deletion symmetric-assemble/src/asciidoc/appendix/dbfill.ad
Expand Up @@ -43,7 +43,8 @@ They are as follows:
- *--repeat <arg>* : Number of times to repeat the count of rows.
- *--rollback <arg>* : Percent chance (0-100) to perform a rollback.
- *--schema <arg>* : Look for tables in schema.
- *--select* : Select foreign key dependent data to satisfy constrains.
- *--select* : Select foreign key dependent data to satisfy constraints.
- *--truncate* : Truncate the tables before filling them.
- *-v, --verbose* : Use verbose format for console output.
- *--weights <arg>* : By default, an insert is performed for each count ('1, 0, 0'). To randomly select between an insert, update or delete on each table, weight can be applied so inserts an occur more than deletes. To make sure inserts happen twice as much as updates, and deletes are never performed use '2,1,0'.

Expand Down
Expand Up @@ -66,6 +66,8 @@ public class DbFillCommand extends AbstractCommandLauncher {
private static final String OPTION_COMMIT_DELAY = "commit-delay";

private static final String OPTION_ROLLBACK = "rollback";

private static final String OPTION_TRUNCATE = "truncate";

public DbFillCommand() {
super("dbfill", "[tablename...]", "DbFill.Option.");
Expand Down Expand Up @@ -111,6 +113,7 @@ protected void buildOptions(Options options) {
addOption(options, null, OPTION_COMMIT, true);
addOption(options, null, OPTION_COMMIT_DELAY, true);
addOption(options, null, OPTION_ROLLBACK, true);
addOption(options, null, OPTION_TRUNCATE, false);
}

@Override
Expand Down Expand Up @@ -181,6 +184,10 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
if (line.hasOption(OPTION_ROLLBACK)) {
dbFill.setPercentRollback(Integer.parseInt(line.getOptionValue(OPTION_ROLLBACK)));
}
if (line.hasOption(OPTION_TRUNCATE)) {
dbFill.setTruncate(true);
}

// Ignore the Symmetric config tables.
getSymmetricEngine();
IParameterService parameterService = engine.getParameterService();
Expand Down
Expand Up @@ -172,6 +172,7 @@ DbFill.Option.rand=Randomize number of rows to generate and commit.
DbFill.Option.repeat=Number of times to repeat the count of rows.
DbFill.Option.rollback=Percent chance (0-100) to perform a rollback.
DbFill.Option.select=Select foreign key dependent data to satisfy constraints.
DbFill.Option.truncate=Truncate the tables before filling them.

DbCompare.Option.exclude=A comma-separated list of table names to exclude from comparison.
DbCompare.Option.output=A file name to output delta SQL (insert/update/delete statements) that would bring the target into sync with the source. You can use the %t pattern to use the table name as part of the file and generate a file per table. (E.g. /output/%t.diff.sql)
Expand Down

0 comments on commit ae60f82

Please sign in to comment.