rake-db 2.4.20 → 2.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1537,6 +1537,10 @@ const processMigration = async (db, up, file, config, options, appCodeUpdaterCac
1537
1537
  };
1538
1538
  const migrate = (options, config, args = []) => migrateOrRollback(options, config, args, true);
1539
1539
  const rollback = (options, config, args = []) => migrateOrRollback(options, config, args, false);
1540
+ const redo = async (options, config, args = []) => {
1541
+ await migrateOrRollback(options, config, args, false);
1542
+ await migrateOrRollback(options, config, args, true);
1543
+ };
1540
1544
 
1541
1545
  const execute = async (options, sql) => {
1542
1546
  const db = new Adapter(options);
@@ -2666,7 +2670,9 @@ const rakeDb = async (options, partialConfig = {}, args = process.argv.slice(2))
2666
2670
  await migrate(options, config, args.slice(1));
2667
2671
  } else if (command === "rollback") {
2668
2672
  await rollback(options, config, args.slice(1));
2669
- } else if (command === "g" || command === "generate") {
2673
+ } else if (command === "redo") {
2674
+ await redo(options, config, args.slice(1));
2675
+ } else if (command === "new") {
2670
2676
  await generate(config, args.slice(1));
2671
2677
  } else if (command === "pull") {
2672
2678
  await pullDbStructure(toArray(options)[0], config);
@@ -2689,9 +2695,10 @@ Commands:
2689
2695
  create create databases
2690
2696
  drop drop databases
2691
2697
  reset drop, create and migrate databases
2692
- g, generate generate migration file, see below
2698
+ new create new migration file, see below
2693
2699
  migrate migrate pending migrations
2694
2700
  rollback rollback the last migrated
2701
+ redo rollback and migrate
2695
2702
  no or unknown command prints this message
2696
2703
 
2697
2704
  Migrate arguments:
@@ -2707,7 +2714,7 @@ Migrate and rollback common arguments:
2707
2714
  --code run code updater, overrides \`useCodeUpdater\` option
2708
2715
  --code false do not run code updater
2709
2716
 
2710
- Generate arguments:
2717
+ New migration file arguments:
2711
2718
  - (required) first argument is migration name
2712
2719
  * create* template for create table
2713
2720
  * change* template for change table
@@ -2716,8 +2723,8 @@ Generate arguments:
2716
2723
  * drop* template for drop table
2717
2724
 
2718
2725
  - other arguments considered as columns with types and optional methods:
2719
- rake-db g createTable id:serial.primaryKey name:text.nullable
2726
+ rake-db new createTable id:serial.primaryKey name:text.nullable
2720
2727
  `;
2721
2728
 
2722
- export { MigrationBase, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
2729
+ export { MigrationBase, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
2723
2730
  //# sourceMappingURL=index.mjs.map