diff --git a/README.md b/README.md index a081157..991c17a 100644 --- a/README.md +++ b/README.md @@ -78,12 +78,11 @@ Once your configuration files are complete, you can use GraMi in one of two ways ```Shell ./bin/grami migrate \ --d /path/to/dataConfig.json \ --p /path/to/processorConfig.json \ --m /path/to/migrationStatus.json \ +-dc /path/to/dataConfig.json \ +-pc /path/to/processorConfig.json \ +-ms /path/to/migrationStatus.json \ -s /path/to/schema.gql \ --k yourFavoriteKeyspace \ --cm +-db yourFavoriteDatabase ``` [See details here](https://github.com/bayer-science-for-a-better-life/grami/wiki/Grami-as-Executable-CLI) @@ -99,9 +98,9 @@ public class Migration { private static final String migrationStatus = "/path/to/your/migrationStatus.json"; private static final String graknURI = "127.0.0.1:1729"; // defines which grakn server to migrate into - private static final String keyspaceName = "yourFavoriteKeyspace"; // defines which keyspace to migrate into + private static final String databaseName = "yourFavoriteDatabase"; // defines which keyspace to migrate into - private static final MigrationConfig migrationConfig = new MigrationConfig(graknURI, keyspaceName, schema, dataConfig, processorConfig); + private static final MigrationConfig migrationConfig = new MigrationConfig(graknURI, databaseName, schema, dataConfig, processorConfig); public static void main(String[] args) throws IOException { GraknMigrator mig = new GraknMigrator(migrationConfig, migrationStatus, true); @@ -119,6 +118,8 @@ A complete tutorial for grakn version >= 2.0 is in work and will be published as A complete tutorial for grakn version >= 1.8.2, but < 2.0 can be found [on Medium](https://medium.com/@hkuich/introducing-grami-a-data-migration-tool-for-grakn-d4051582f867). +There is this [example repository](https://github.com/bayer-science-for-a-better-life/grami-example). + ## Compatibility GraMi version >= 0.1.0 is tested for: diff --git a/src/main/java/cli/GramiCLI.java b/src/main/java/cli/GramiCLI.java index 43f682b..3f5895b 100644 --- a/src/main/java/cli/GramiCLI.java +++ b/src/main/java/cli/GramiCLI.java @@ -8,7 +8,7 @@ import java.io.IOException; -@CommandLine.Command(description="Welcome to the CLI of GraMi - your grakn data migration tool", name = "grami", version = "0.1.0", mixinStandardHelpOptions = true) +@CommandLine.Command(description="Welcome to the CLI of GraMi - your grakn data migration tool", name = "grami", version = "0.1.0-alpha-9", mixinStandardHelpOptions = true) public class GramiCLI { public static void main(String[] args) { @@ -25,20 +25,20 @@ public static void main(String[] args) { class MigrateCommand implements Runnable { @CommandLine.Spec CommandLine.Model.CommandSpec spec; - @CommandLine.Option(names = {"-d", "--dataConfigFile"}, description = "data config file in JSON format", required = true) + @CommandLine.Option(names = {"-dc", "--dataConfigFile"}, description = "data config file in JSON format", required = true) private String dataConfigFilePath; - @CommandLine.Option(names = {"-p", "--processorConfigFile"}, description = "processor config file in JSON format", required = true) + @CommandLine.Option(names = {"-pc", "--processorConfigFile"}, description = "processor config file in JSON format", required = true) private String processorConfigFilePath; - @CommandLine.Option(names = {"-m", "--migrationStatusFile"}, description = "file to track migration status in", required = true) + @CommandLine.Option(names = {"-ms", "--migrationStatusFile"}, description = "file to track migration status in", required = true) private String migrationStatusFilePath; @CommandLine.Option(names = {"-s", "--schemaFile"}, description = "your schema file as .gql", required = true) private String schemaFilePath; - @CommandLine.Option(names = {"-k", "--keyspace"}, description = "target keyspace in your grakn instance", required = true) - private String keyspaceName; + @CommandLine.Option(names = {"-db", "--database"}, description = "target database in your grakn instance", required = true) + private String databaseName; @CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:1729)", defaultValue = "localhost:1729") private String graknURI; @@ -57,12 +57,12 @@ public void run() { spec.commandLine().getOut().println("\tprocessor configuration: " + processorConfigFilePath); spec.commandLine().getOut().println("\ttracking migration status in: " + migrationStatusFilePath); spec.commandLine().getOut().println("\tschema: " + schemaFilePath); - spec.commandLine().getOut().println("\tkeyspace: " + keyspaceName); + spec.commandLine().getOut().println("\tdatabase: " + databaseName); spec.commandLine().getOut().println("\tgrakn server: " + graknURI); - spec.commandLine().getOut().println("\tdelete keyspace and all data in it for a clean new migration?: " + cleanMigration); + spec.commandLine().getOut().println("\tdelete database and all data in it for a clean new migration?: " + cleanMigration); spec.commandLine().getOut().println("\tmigration scope: " + scope); - final MigrationConfig migrationConfig = new MigrationConfig(graknURI, keyspaceName, schemaFilePath, dataConfigFilePath, processorConfigFilePath); + final MigrationConfig migrationConfig = new MigrationConfig(graknURI, databaseName, schemaFilePath, dataConfigFilePath, processorConfigFilePath); try { GraknMigrator mig = new GraknMigrator(migrationConfig, migrationStatusFilePath, cleanMigration); @@ -91,10 +91,10 @@ class SchemaUpdateCommand implements Runnable { @CommandLine.Option(names = {"-s", "--schemaFile"}, description = "your schema file as .gql", required = true) private String schemaFilePath; - @CommandLine.Option(names = {"-k", "--keyspace"}, description = "target keyspace in your grakn instance", required = true) - private String keyspaceName; + @CommandLine.Option(names = {"-db", "--database"}, description = "target database in your grakn instance", required = true) + private String databaseName; - @CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:48555)", defaultValue = "localhost:48555") + @CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:1729)", defaultValue = "localhost:1729") private String graknURI; @Override @@ -102,10 +102,10 @@ public void run() { spec.commandLine().getOut().println("############## GraMi schema-update ###############"); spec.commandLine().getOut().println("schema-update started with parameters:"); spec.commandLine().getOut().println("\tschema: " + schemaFilePath); - spec.commandLine().getOut().println("\tkeyspace: " + keyspaceName); + spec.commandLine().getOut().println("\tkeyspace: " + databaseName); spec.commandLine().getOut().println("\tgrakn server: " + graknURI); - SchemaUpdateConfig suConfig = new SchemaUpdateConfig(graknURI, keyspaceName, schemaFilePath); + SchemaUpdateConfig suConfig = new SchemaUpdateConfig(graknURI, databaseName, schemaFilePath); SchemaUpdater su = new SchemaUpdater(suConfig); su.updateSchema(); } diff --git a/src/test/java/cli/GramiCLITest.java b/src/test/java/cli/GramiCLITest.java index 216176f..0ce6bb6 100644 --- a/src/test/java/cli/GramiCLITest.java +++ b/src/test/java/cli/GramiCLITest.java @@ -14,11 +14,11 @@ public class GramiCLITest { public void migrateTest() { String[] args = { "migrate", - "-d", "src/test/resources/phone-calls/dataConfig.json", - "-p", "src/test/resources/phone-calls/processorConfig.json", - "-m", "src/test/resources/phone-calls/migrationStatus.json", + "-dc", "src/test/resources/phone-calls/dataConfig.json", + "-pc", "src/test/resources/phone-calls/processorConfig.json", + "-ms", "src/test/resources/phone-calls/migrationStatus.json", "-s", "src/test/resources/phone-calls/schema.gql", - "-k", "grami_cli_test", + "-db", "grami_cli_test", "-g", "127.0.0.1:1729", "-cm" }; @@ -41,7 +41,7 @@ public void updateTest() { String[] args = { "schema-update", "-s", "src/test/resources/phone-calls/schema-updated.gql", - "-k", "grami_cli_test", + "-db", "grami_cli_test", "-g", "127.0.0.1:1729", }; diff --git a/src/test/java/migrator/MigrationTest.java b/src/test/java/migrator/MigrationTest.java index 20fef92..bcb078e 100644 --- a/src/test/java/migrator/MigrationTest.java +++ b/src/test/java/migrator/MigrationTest.java @@ -22,7 +22,7 @@ public class MigrationTest { - String graknURI = "localhost:1730"; + String graknURI = "localhost:1729"; @Test public void migrateGenericTestsTest() throws IOException {