From b27989f54128114059d03bc2f0b44c9d746c964c Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Fri, 21 Aug 2015 21:37:36 +1200 Subject: [PATCH] #396 - Rename migration method to DbMigration.generateMigration() ... update javadoc --- .../avaje/ebean/dbmigration/DbMigration.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/avaje/ebean/dbmigration/DbMigration.java b/src/main/java/com/avaje/ebean/dbmigration/DbMigration.java index 33b918f80..805a176c0 100644 --- a/src/main/java/com/avaje/ebean/dbmigration/DbMigration.java +++ b/src/main/java/com/avaje/ebean/dbmigration/DbMigration.java @@ -40,6 +40,18 @@ import java.util.List; * changes and a series of sql scripts to apply, rollback the applied changes if necessary * and drop objects (drop tables, drop columns). *

+ *

+ * This does not run the migration or ddl scripts but just generates them. + *

+ *
{@code
+ *
+ *       DbMigration migration = new DbMigration();
+ *       migration.setPathToResources("src/main/resources");
+ *       migration.setPlatform(DbPlatformName.ORACLE);
+ *
+ *       migration.generateMigration();
+ *
+ * }
*/ public class DbMigration { @@ -131,9 +143,36 @@ public class DbMigration { } /** - * Run the migration generating the next migration xml file and associated apply and rollback sql scripts. + * Generate the next migration xml file and associated apply and rollback sql scripts. + *

+ * This does not run the migration or ddl scripts but just generates them. + *

+ *

Example: Run for a single specific platform

+ *
{@code
+   *
+   *       DbMigration migration = new DbMigration();
+   *       migration.setPathToResources("src/main/resources");
+   *       migration.setPlatform(DbPlatformName.ORACLE);
+   *
+   *       migration.generateMigration();
+   *
+   * }
+ * + *

Example: Run migration generating DDL for multiple platforms

+ *
{@code
+   *
+   *       DbMigration migration = new DbMigration();
+   *       migration.setPathToResources("src/main/resources");
+   *
+   *       migration.addPlatform(DbPlatformName.POSTGRES, "pg");
+   *       migration.addPlatform(DbPlatformName.MYSQL, "mysql");
+   *       migration.addPlatform(DbPlatformName.ORACLE, "mysql");
+   *
+   *       migration.generateMigration();
+   *
+   * }
*/ - public void runMigration() throws IOException { + public void generateMigration() throws IOException { // use this flag to stop other plugins like full DDL generation DbOffline.setRunningMigration();