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.d.ts +2 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -247,6 +247,7 @@ declare const migrateOrRollback: (options: MaybeArray<AdapterOptions>, config: R
|
|
|
247
247
|
declare const changeCache: Record<string, ChangeCallback[] | undefined>;
|
|
248
248
|
declare const migrate: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig, args?: string[]) => Promise<void>;
|
|
249
249
|
declare const rollback: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig, args?: string[]) => Promise<void>;
|
|
250
|
+
declare const redo: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig, args?: string[]) => Promise<void>;
|
|
250
251
|
|
|
251
252
|
declare const rakeDb: (options: MaybeArray<AdapterOptions>, partialConfig?: Partial<RakeDbConfig>, args?: string[]) => Promise<void>;
|
|
252
253
|
|
|
@@ -254,4 +255,4 @@ declare const saveMigratedVersion: (db: Adapter, version: string, config: RakeDb
|
|
|
254
255
|
declare const removeMigratedVersion: (db: Adapter, version: string, config: RakeDbConfig) => Promise<void>;
|
|
255
256
|
declare const getMigratedVersionsMap: (db: Adapter, config: RakeDbConfig) => Promise<Record<string, boolean>>;
|
|
256
257
|
|
|
257
|
-
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
|
|
258
|
+
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
|
package/dist/index.js
CHANGED
|
@@ -1565,6 +1565,10 @@ const processMigration = async (db, up, file, config, options, appCodeUpdaterCac
|
|
|
1565
1565
|
};
|
|
1566
1566
|
const migrate = (options, config, args = []) => migrateOrRollback(options, config, args, true);
|
|
1567
1567
|
const rollback = (options, config, args = []) => migrateOrRollback(options, config, args, false);
|
|
1568
|
+
const redo = async (options, config, args = []) => {
|
|
1569
|
+
await migrateOrRollback(options, config, args, false);
|
|
1570
|
+
await migrateOrRollback(options, config, args, true);
|
|
1571
|
+
};
|
|
1568
1572
|
|
|
1569
1573
|
const execute = async (options, sql) => {
|
|
1570
1574
|
const db = new pqb.Adapter(options);
|
|
@@ -2694,7 +2698,9 @@ const rakeDb = async (options, partialConfig = {}, args = process.argv.slice(2))
|
|
|
2694
2698
|
await migrate(options, config, args.slice(1));
|
|
2695
2699
|
} else if (command === "rollback") {
|
|
2696
2700
|
await rollback(options, config, args.slice(1));
|
|
2697
|
-
} else if (command === "
|
|
2701
|
+
} else if (command === "redo") {
|
|
2702
|
+
await redo(options, config, args.slice(1));
|
|
2703
|
+
} else if (command === "new") {
|
|
2698
2704
|
await generate(config, args.slice(1));
|
|
2699
2705
|
} else if (command === "pull") {
|
|
2700
2706
|
await pullDbStructure(orchidCore.toArray(options)[0], config);
|
|
@@ -2717,9 +2723,10 @@ Commands:
|
|
|
2717
2723
|
create create databases
|
|
2718
2724
|
drop drop databases
|
|
2719
2725
|
reset drop, create and migrate databases
|
|
2720
|
-
|
|
2726
|
+
new create new migration file, see below
|
|
2721
2727
|
migrate migrate pending migrations
|
|
2722
2728
|
rollback rollback the last migrated
|
|
2729
|
+
redo rollback and migrate
|
|
2723
2730
|
no or unknown command prints this message
|
|
2724
2731
|
|
|
2725
2732
|
Migrate arguments:
|
|
@@ -2735,7 +2742,7 @@ Migrate and rollback common arguments:
|
|
|
2735
2742
|
--code run code updater, overrides \`useCodeUpdater\` option
|
|
2736
2743
|
--code false do not run code updater
|
|
2737
2744
|
|
|
2738
|
-
|
|
2745
|
+
New migration file arguments:
|
|
2739
2746
|
- (required) first argument is migration name
|
|
2740
2747
|
* create* template for create table
|
|
2741
2748
|
* change* template for change table
|
|
@@ -2744,7 +2751,7 @@ Generate arguments:
|
|
|
2744
2751
|
* drop* template for drop table
|
|
2745
2752
|
|
|
2746
2753
|
- other arguments considered as columns with types and optional methods:
|
|
2747
|
-
rake-db
|
|
2754
|
+
rake-db new createTable id:serial.primaryKey name:text.nullable
|
|
2748
2755
|
`;
|
|
2749
2756
|
|
|
2750
2757
|
exports.MigrationBase = MigrationBase;
|
|
@@ -2759,6 +2766,7 @@ exports.makeFileTimeStamp = makeFileTimeStamp;
|
|
|
2759
2766
|
exports.migrate = migrate;
|
|
2760
2767
|
exports.migrateOrRollback = migrateOrRollback;
|
|
2761
2768
|
exports.rakeDb = rakeDb;
|
|
2769
|
+
exports.redo = redo;
|
|
2762
2770
|
exports.removeMigratedVersion = removeMigratedVersion;
|
|
2763
2771
|
exports.resetDb = resetDb;
|
|
2764
2772
|
exports.rollback = rollback;
|