rake-db 2.3.9 → 2.3.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # rake-db
2
2
 
3
+ ## 2.3.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Add custom commands to rake-db
8
+
3
9
  ## 2.3.9
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -393,6 +393,7 @@ declare type Db = DbResult<typeof columnTypes>;
393
393
  declare type RakeDbConfig = {
394
394
  migrationsPath: string;
395
395
  migrationsTable: string;
396
+ commands: Record<string, (options: AdapterOptions[], config: RakeDbConfig, args: string[]) => Promise<void>>;
396
397
  requireTs(path: string): Promise<void>;
397
398
  noPrimaryKey?: NoPrimaryKeyOption;
398
399
  appCodeUpdater?: AppCodeUpdater;
package/dist/index.js CHANGED
@@ -50,8 +50,9 @@ var __spreadValues$6 = (a, b) => {
50
50
  };
51
51
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
52
52
  const migrationConfigDefaults = {
53
- migrationsPath: path__default["default"].resolve("src", "migrations"),
53
+ migrationsPath: path__default["default"].resolve("src", "db", "migrations"),
54
54
  migrationsTable: "schemaMigrations",
55
+ commands: {},
55
56
  requireTs: (path2) => (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(path2),
56
57
  log: true,
57
58
  logger: console,
@@ -1961,6 +1962,8 @@ const rakeDb = async (options, partialConfig = {}, args = process.argv.slice(2))
1961
1962
  await generate(config, args.slice(1));
1962
1963
  } else if (command === "pull") {
1963
1964
  await pullDbStructure(pqb.toArray(options)[0], config);
1965
+ } else if (config.commands[command]) {
1966
+ await config.commands[command](pqb.toArray(options), config, args.slice(1));
1964
1967
  } else {
1965
1968
  printHelp();
1966
1969
  }