Skip to content

Commit

Permalink
0002638: Allow send-schema to send all tables when no tables as
Browse files Browse the repository at this point in the history
arguments
  • Loading branch information
erilong committed Jun 10, 2016
1 parent 043b924 commit 306aede
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Expand Up @@ -51,6 +51,7 @@
import org.jumpmind.security.SecurityConstants;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.TriggerHistory;
import org.jumpmind.symmetric.service.IDataExtractorService;
import org.jumpmind.symmetric.service.IDataLoaderService;
import org.jumpmind.symmetric.service.IDataService;
Expand Down Expand Up @@ -586,13 +587,27 @@ private void reloadTable(CommandLine line, List<String> args) {
}

private void sendSchema(CommandLine line, List<String> args) {
String tableName = popArg(args, "Table Name");
String catalog = line.getOptionValue(OPTION_CATALOG);
String schema = line.getOptionValue(OPTION_SCHEMA);
Collection<Node> nodes = getNodes(line);
for (Node node : nodes) {
getSymmetricEngine().getDataService().sendSchema(node.getNodeId(), catalog, schema,
tableName, false);

if (args.size() == 0) {
for (TriggerHistory hist : engine.getTriggerRouterService().getActiveTriggerHistories()) {
for (Node node : nodes) {
if ((catalog == null || catalog.equals(hist.getSourceCatalogName())) &&
(schema == null || schema.equals(hist.getSourceSchemaName()))) {
getSymmetricEngine().getDataService().sendSchema(node.getNodeId(), hist.getSourceCatalogName(),
hist.getSourceSchemaName(), hist.getSourceTableName(), false);
}
}
}
} else {
for (String tableName : args) {
for (Node node : nodes) {
getSymmetricEngine().getDataService().sendSchema(node.getNodeId(), catalog,
schema, tableName, false);
}
}
}
}

Expand Down
Expand Up @@ -89,7 +89,7 @@ SymAdmin.Usage.sync-triggers=[<tablename> ...]
SymAdmin.Usage.drop-triggers=[<tablename> ...]
SymAdmin.Usage.export-properties=[<filename>]
SymAdmin.Usage.send-sql=<table> <sql>
SymAdmin.Usage.send-schema=<table>
SymAdmin.Usage.send-schema=[<table>] ...
SymAdmin.Usage.send-script=<filename>
SymAdmin.Usage.uninstall=
SymAdmin.Help.export-sym-tables=Output the SQL to create the SymmetricDS tables. If a filename is given, the SQL statements are written to it, otherwise standard output is used.
Expand All @@ -109,7 +109,7 @@ SymAdmin.Help.create-war=Generate a web archive that can be deployed to a web se
SymAdmin.Help.reload-node=Send an initial load of data to reload a remote node.
SymAdmin.Help.reload-table=Send the data from the specified tables to a node or group of nodes.
SymAdmin.Help.send-sql=Send a SQL statement to be executed on a remote node.
SymAdmin.Help.send-schema=Send a schema update for a table to be executed on a remote node. The table definition is sent in torque XML format. If the target table is missing, it is created; if it exists it will be altered, if possible, otherwise dropped and re-created.
SymAdmin.Help.send-schema=Send a schema update for a table to be executed on a remote node. The table definition is sent in torque XML format. If the target table is missing, it is created; if it exists it will be altered, if possible, otherwise dropped and re-created. Specify which tables to send or use no arguments to mean all configured tables.
SymAdmin.Help.send-script=Send a script to a node to be run there. The script is read from the filename provided as an argument or read from standard input. Only BeanShell scripts are supported.
SymAdmin.Help.uninstall=Uninstall all SymmetricDS objects from the database, including the SYM tables, sequences, functions, stored procedures, and triggers.
SymAdmin.Option.catalog=Look for tables in catalog.
Expand Down

0 comments on commit 306aede

Please sign in to comment.