rake-db 2.10.48 → 2.10.49

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 CHANGED
@@ -1059,7 +1059,7 @@ type RakeDbFn = (<C extends ColumnTypesBase = DefaultColumnTypes>(options: Maybe
1059
1059
  */
1060
1060
  type RakeDbLazyFn = <C extends ColumnTypesBase = DefaultColumnTypes>(options: MaybeArray<AdapterOptions>, partialConfig?: InputRakeDbConfig<C>) => {
1061
1061
  change: RakeDbChangeFn<C>;
1062
- run(args: string[]): Promise<void>;
1062
+ run(args: string[], config?: Partial<RakeDbConfig<C>>): Promise<void>;
1063
1063
  };
1064
1064
  /**
1065
1065
  * Function to use in migrations to wrap database changes
package/dist/index.js CHANGED
@@ -7,21 +7,21 @@ var promises = require('fs/promises');
7
7
  var prompts = require('prompts');
8
8
  var url = require('url');
9
9
 
10
- var __defProp$6 = Object.defineProperty;
10
+ var __defProp$7 = Object.defineProperty;
11
11
  var __defProps$5 = Object.defineProperties;
12
12
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
13
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
14
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
15
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
16
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __spreadValues$6 = (a, b) => {
13
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
16
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __spreadValues$7 = (a, b) => {
18
18
  for (var prop in b || (b = {}))
19
- if (__hasOwnProp$6.call(b, prop))
20
- __defNormalProp$6(a, prop, b[prop]);
21
- if (__getOwnPropSymbols$6)
22
- for (var prop of __getOwnPropSymbols$6(b)) {
23
- if (__propIsEnum$6.call(b, prop))
24
- __defNormalProp$6(a, prop, b[prop]);
19
+ if (__hasOwnProp$7.call(b, prop))
20
+ __defNormalProp$7(a, prop, b[prop]);
21
+ if (__getOwnPropSymbols$7)
22
+ for (var prop of __getOwnPropSymbols$7(b)) {
23
+ if (__propIsEnum$7.call(b, prop))
24
+ __defNormalProp$7(a, prop, b[prop]);
25
25
  }
26
26
  return a;
27
27
  };
@@ -29,11 +29,11 @@ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
29
29
  var __objRest$2 = (source, exclude) => {
30
30
  var target = {};
31
31
  for (var prop in source)
32
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
32
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
33
33
  target[prop] = source[prop];
34
- if (source != null && __getOwnPropSymbols$6)
35
- for (var prop of __getOwnPropSymbols$6(source)) {
36
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
34
+ if (source != null && __getOwnPropSymbols$7)
35
+ for (var prop of __getOwnPropSymbols$7(source)) {
36
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
37
37
  target[prop] = source[prop];
38
38
  }
39
39
  return target;
@@ -58,7 +58,7 @@ const migrationConfigDefaults = {
58
58
  };
59
59
  const processRakeDbConfig = (config) => {
60
60
  var _a;
61
- const result = __spreadValues$6(__spreadValues$6({}, migrationConfigDefaults), config);
61
+ const result = __spreadValues$7(__spreadValues$7({}, migrationConfigDefaults), config);
62
62
  if (!result.recurrentPath) {
63
63
  result.recurrentPath = path.join(result.migrationsPath, "recurrent");
64
64
  }
@@ -133,9 +133,9 @@ const setAdapterOptions = (options, set) => {
133
133
  if (set.password !== void 0) {
134
134
  url.password = set.password;
135
135
  }
136
- return __spreadProps$5(__spreadValues$6({}, options), { databaseURL: url.toString() });
136
+ return __spreadProps$5(__spreadValues$7({}, options), { databaseURL: url.toString() });
137
137
  } else {
138
- return __spreadValues$6(__spreadValues$6({}, options), set);
138
+ return __spreadValues$7(__spreadValues$7({}, options), set);
139
139
  }
140
140
  };
141
141
  const setAdminCredentialsToOptions = async (options, create) => {
@@ -164,7 +164,7 @@ const setAdminCredentialsToOptions = async (options, create) => {
164
164
  name: "password"
165
165
  }
166
166
  ]);
167
- return setAdapterOptions(options, __spreadProps$5(__spreadValues$6({}, values), {
167
+ return setAdapterOptions(options, __spreadProps$5(__spreadValues$7({}, values), {
168
168
  password: values.password || void 0
169
169
  }));
170
170
  };
@@ -229,7 +229,7 @@ const getMigrations = async (_a, up) => {
229
229
  } = _b, config = __objRest$2(_b, [
230
230
  "migrations"
231
231
  ]);
232
- return migrations ? getMigrationsFromConfig(__spreadProps$5(__spreadValues$6({}, config), { migrations }), up) : getMigrationsFromFiles(config, up);
232
+ return migrations ? getMigrationsFromConfig(__spreadProps$5(__spreadValues$7({}, config), { migrations }), up) : getMigrationsFromFiles(config, up);
233
233
  };
234
234
  function getMigrationsFromConfig(config, up) {
235
235
  const result = [];
@@ -335,21 +335,21 @@ const clearChanges = () => {
335
335
  const getCurrentChanges = () => currentChanges;
336
336
  const pushChange = (fn) => currentChanges.push(fn);
337
337
 
338
- var __defProp$5 = Object.defineProperty;
338
+ var __defProp$6 = Object.defineProperty;
339
339
  var __defProps$4 = Object.defineProperties;
340
340
  var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
341
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
342
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
343
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
344
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
345
- var __spreadValues$5 = (a, b) => {
341
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
342
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
343
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
344
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
345
+ var __spreadValues$6 = (a, b) => {
346
346
  for (var prop in b || (b = {}))
347
- if (__hasOwnProp$5.call(b, prop))
348
- __defNormalProp$5(a, prop, b[prop]);
349
- if (__getOwnPropSymbols$5)
350
- for (var prop of __getOwnPropSymbols$5(b)) {
351
- if (__propIsEnum$5.call(b, prop))
352
- __defNormalProp$5(a, prop, b[prop]);
347
+ if (__hasOwnProp$6.call(b, prop))
348
+ __defNormalProp$6(a, prop, b[prop]);
349
+ if (__getOwnPropSymbols$6)
350
+ for (var prop of __getOwnPropSymbols$6(b)) {
351
+ if (__propIsEnum$6.call(b, prop))
352
+ __defNormalProp$6(a, prop, b[prop]);
353
353
  }
354
354
  return a;
355
355
  };
@@ -447,7 +447,7 @@ const addColumnIndex = (indexes, name, item) => {
447
447
  if (item.data.indexes) {
448
448
  indexes.push(
449
449
  ...item.data.indexes.map((index) => ({
450
- columns: [__spreadProps$4(__spreadValues$5({}, index), { column: name })],
450
+ columns: [__spreadProps$4(__spreadValues$6({}, index), { column: name })],
451
451
  options: index
452
452
  }))
453
453
  );
@@ -624,21 +624,21 @@ class RakeDbError extends Error {
624
624
  class NoPrimaryKey extends RakeDbError {
625
625
  }
626
626
 
627
- var __defProp$4 = Object.defineProperty;
627
+ var __defProp$5 = Object.defineProperty;
628
628
  var __defProps$3 = Object.defineProperties;
629
629
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
630
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
631
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
632
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
633
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
634
- var __spreadValues$4 = (a, b) => {
630
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
631
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
632
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
633
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
634
+ var __spreadValues$5 = (a, b) => {
635
635
  for (var prop in b || (b = {}))
636
- if (__hasOwnProp$4.call(b, prop))
637
- __defNormalProp$4(a, prop, b[prop]);
638
- if (__getOwnPropSymbols$4)
639
- for (var prop of __getOwnPropSymbols$4(b)) {
640
- if (__propIsEnum$4.call(b, prop))
641
- __defNormalProp$4(a, prop, b[prop]);
636
+ if (__hasOwnProp$5.call(b, prop))
637
+ __defNormalProp$5(a, prop, b[prop]);
638
+ if (__getOwnPropSymbols$5)
639
+ for (var prop of __getOwnPropSymbols$5(b)) {
640
+ if (__propIsEnum$5.call(b, prop))
641
+ __defNormalProp$5(a, prop, b[prop]);
642
642
  }
643
643
  return a;
644
644
  };
@@ -646,11 +646,11 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
646
646
  var __objRest$1 = (source, exclude) => {
647
647
  var target = {};
648
648
  for (var prop in source)
649
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
649
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
650
650
  target[prop] = source[prop];
651
- if (source != null && __getOwnPropSymbols$4)
652
- for (var prop of __getOwnPropSymbols$4(source)) {
653
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
651
+ if (source != null && __getOwnPropSymbols$5)
652
+ for (var prop of __getOwnPropSymbols$5(source)) {
653
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
654
654
  target[prop] = source[prop];
655
655
  }
656
656
  return target;
@@ -706,14 +706,14 @@ const makeAst$2 = (up, tableName, shape, tableData, options, noPrimaryKey) => {
706
706
  }
707
707
  const { primaryKey } = tableData;
708
708
  const [schema, table] = getSchemaAndTableFromName(tableName);
709
- return __spreadProps$3(__spreadValues$4(__spreadProps$3(__spreadValues$4({
709
+ return __spreadProps$3(__spreadValues$5(__spreadProps$3(__spreadValues$5({
710
710
  type: "table",
711
711
  action: up ? "create" : "drop",
712
712
  schema,
713
713
  name: table,
714
714
  shape
715
715
  }, tableData), {
716
- primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$3(__spreadValues$4({}, primaryKey), { columns: [...shapePKeys, ...primaryKey.columns] }) : { columns: shapePKeys }
716
+ primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$3(__spreadValues$5({}, primaryKey), { columns: [...shapePKeys, ...primaryKey.columns] }) : { columns: shapePKeys }
717
717
  }), options), {
718
718
  noPrimaryKey: options.noPrimaryKey ? "ignore" : noPrimaryKey || "error"
719
719
  });
@@ -790,8 +790,8 @@ const astToQueries$1 = (ast, snakeCase, language) => {
790
790
  ${constraintToSql(
791
791
  ast,
792
792
  true,
793
- __spreadProps$3(__spreadValues$4({}, item), {
794
- references: item.references ? __spreadProps$3(__spreadValues$4({}, item.references), {
793
+ __spreadProps$3(__spreadValues$5({}, item), {
794
+ references: item.references ? __spreadProps$3(__spreadValues$5({}, item.references), {
795
795
  columns: item.references.columns.map(
796
796
  (column) => getColumnName(shape[column], column, snakeCase)
797
797
  )
@@ -803,8 +803,8 @@ const astToQueries$1 = (ast, snakeCase, language) => {
803
803
  );
804
804
  });
805
805
  indexes.push(
806
- ...((_b = ast.indexes) == null ? void 0 : _b.map((index) => __spreadProps$3(__spreadValues$4({}, index), {
807
- columns: index.columns.map((item) => __spreadValues$4(__spreadValues$4({}, item), "column" in item ? {
806
+ ...((_b = ast.indexes) == null ? void 0 : _b.map((index) => __spreadProps$3(__spreadValues$5({}, index), {
807
+ columns: index.columns.map((item) => __spreadValues$5(__spreadValues$5({}, item), "column" in item ? {
808
808
  column: getColumnName(shape[item.column], item.column, snakeCase)
809
809
  } : {}))
810
810
  }))) || []
@@ -826,21 +826,21 @@ const astToQueries$1 = (ast, snakeCase, language) => {
826
826
  return queries;
827
827
  };
828
828
 
829
- var __defProp$3 = Object.defineProperty;
829
+ var __defProp$4 = Object.defineProperty;
830
830
  var __defProps$2 = Object.defineProperties;
831
831
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
832
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
833
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
834
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
835
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
836
- var __spreadValues$3 = (a, b) => {
832
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
833
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
834
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
835
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
836
+ var __spreadValues$4 = (a, b) => {
837
837
  for (var prop in b || (b = {}))
838
- if (__hasOwnProp$3.call(b, prop))
839
- __defNormalProp$3(a, prop, b[prop]);
840
- if (__getOwnPropSymbols$3)
841
- for (var prop of __getOwnPropSymbols$3(b)) {
842
- if (__propIsEnum$3.call(b, prop))
843
- __defNormalProp$3(a, prop, b[prop]);
838
+ if (__hasOwnProp$4.call(b, prop))
839
+ __defNormalProp$4(a, prop, b[prop]);
840
+ if (__getOwnPropSymbols$4)
841
+ for (var prop of __getOwnPropSymbols$4(b)) {
842
+ if (__propIsEnum$4.call(b, prop))
843
+ __defNormalProp$4(a, prop, b[prop]);
844
844
  }
845
845
  return a;
846
846
  };
@@ -860,7 +860,7 @@ const mergeTableData = (a, b) => {
860
860
  } else {
861
861
  a.primaryKey = {
862
862
  columns: [...a.primaryKey.columns, ...b.primaryKey.columns],
863
- options: __spreadValues$3(__spreadValues$3({}, a.primaryKey.options), b.primaryKey.options)
863
+ options: __spreadValues$4(__spreadValues$4({}, a.primaryKey.options), b.primaryKey.options)
864
864
  };
865
865
  }
866
866
  }
@@ -923,7 +923,7 @@ const addOrDrop = (type, item, options) => {
923
923
  check: item.data.check
924
924
  }
925
925
  });
926
- return __spreadValues$3({
926
+ return __spreadValues$4({
927
927
  type: "change",
928
928
  from: type === "add" ? empty : add2,
929
929
  to: type === "add" ? add2 : empty
@@ -941,7 +941,7 @@ const columnTypeToColumnChange = (item) => {
941
941
  if (foreignKeys == null ? void 0 : foreignKeys.some((it) => "fn" in it)) {
942
942
  throw new Error("Callback in foreignKey is not allowed in migration");
943
943
  }
944
- return __spreadProps$2(__spreadValues$3({
944
+ return __spreadProps$2(__spreadValues$4({
945
945
  column: item,
946
946
  type: item.toSQL(),
947
947
  nullable: item.data.isNullable,
@@ -953,7 +953,7 @@ const columnTypeToColumnChange = (item) => {
953
953
  return item.to;
954
954
  };
955
955
  const nameKey = Symbol("name");
956
- const tableChangeMethods = __spreadProps$2(__spreadValues$3({}, tableMethods), {
956
+ const tableChangeMethods = __spreadProps$2(__spreadValues$4({}, tableMethods), {
957
957
  name(name) {
958
958
  const types = Object.create(pqb.columnTypes.name.call(this, name));
959
959
  types[nameKey] = name;
@@ -962,7 +962,7 @@ const tableChangeMethods = __spreadProps$2(__spreadValues$3({}, tableMethods), {
962
962
  add,
963
963
  drop,
964
964
  change(from, to, options) {
965
- return __spreadValues$3({
965
+ return __spreadValues$4({
966
966
  type: "change",
967
967
  name: this[nameKey],
968
968
  from: columnTypeToColumnChange(from),
@@ -1022,18 +1022,18 @@ const makeAst$1 = (up, name, changeData, changeTableData2, options) => {
1022
1022
  }
1023
1023
  if ("type" in item) {
1024
1024
  if (up) {
1025
- shape[key] = item.type === "change" && item.usingUp ? __spreadProps$2(__spreadValues$3({}, item), { using: item.usingUp }) : item;
1025
+ shape[key] = item.type === "change" && item.usingUp ? __spreadProps$2(__spreadValues$4({}, item), { using: item.usingUp }) : item;
1026
1026
  } else {
1027
1027
  if (item.type === "rename") {
1028
- shape[item.name] = __spreadProps$2(__spreadValues$3({}, item), { name: key });
1028
+ shape[item.name] = __spreadProps$2(__spreadValues$4({}, item), { name: key });
1029
1029
  } else {
1030
- shape[key] = item.type === "add" ? __spreadProps$2(__spreadValues$3({}, item), { type: "drop" }) : item.type === "drop" ? __spreadProps$2(__spreadValues$3({}, item), { type: "add" }) : item.type === "change" ? __spreadProps$2(__spreadValues$3({}, item), { from: item.to, to: item.from, using: item.usingDown }) : item;
1030
+ shape[key] = item.type === "add" ? __spreadProps$2(__spreadValues$4({}, item), { type: "drop" }) : item.type === "drop" ? __spreadProps$2(__spreadValues$4({}, item), { type: "add" }) : item.type === "change" ? __spreadProps$2(__spreadValues$4({}, item), { from: item.to, to: item.from, using: item.usingDown }) : item;
1031
1031
  }
1032
1032
  }
1033
1033
  }
1034
1034
  }
1035
1035
  const [schema, table] = getSchemaAndTableFromName(name);
1036
- return __spreadValues$3({
1036
+ return __spreadValues$4({
1037
1037
  type: "changeTable",
1038
1038
  schema,
1039
1039
  name: table,
@@ -1227,7 +1227,7 @@ const astToQueries = (ast, snakeCase, language) => {
1227
1227
  if (fromIndex) {
1228
1228
  dropIndexes.push({
1229
1229
  columns: [
1230
- __spreadValues$3({
1230
+ __spreadValues$4({
1231
1231
  column: name
1232
1232
  }, fromIndex)
1233
1233
  ],
@@ -1237,7 +1237,7 @@ const astToQueries = (ast, snakeCase, language) => {
1237
1237
  if (toIndex) {
1238
1238
  addIndexes.push({
1239
1239
  columns: [
1240
- __spreadValues$3({
1240
+ __spreadValues$4({
1241
1241
  column: name
1242
1242
  }, toIndex)
1243
1243
  ],
@@ -1302,13 +1302,13 @@ const mapIndexesForSnakeCase = (indexes, snakeCase) => {
1302
1302
  return (indexes == null ? void 0 : indexes.map((index) => ({
1303
1303
  options: index.options,
1304
1304
  columns: snakeCase ? index.columns.map(
1305
- (item) => "column" in item ? __spreadProps$2(__spreadValues$3({}, item), { column: orchidCore.toSnakeCase(item.column) }) : item
1305
+ (item) => "column" in item ? __spreadProps$2(__spreadValues$4({}, item), { column: orchidCore.toSnakeCase(item.column) }) : item
1306
1306
  ) : index.columns
1307
1307
  }))) || [];
1308
1308
  };
1309
1309
  const mapConstraintsToSnakeCase = (foreignKeys, snakeCase) => {
1310
- return (foreignKeys == null ? void 0 : foreignKeys.map((item) => __spreadProps$2(__spreadValues$3({}, item), {
1311
- references: item.references ? snakeCase ? __spreadProps$2(__spreadValues$3({}, item.references), {
1310
+ return (foreignKeys == null ? void 0 : foreignKeys.map((item) => __spreadProps$2(__spreadValues$4({}, item), {
1311
+ references: item.references ? snakeCase ? __spreadProps$2(__spreadValues$4({}, item.references), {
1312
1312
  columns: item.references.columns.map(orchidCore.toSnakeCase)
1313
1313
  }) : item.references : void 0
1314
1314
  }))) || [];
@@ -1376,21 +1376,21 @@ const astToQuery = (ast) => {
1376
1376
  };
1377
1377
  };
1378
1378
 
1379
- var __defProp$2 = Object.defineProperty;
1379
+ var __defProp$3 = Object.defineProperty;
1380
1380
  var __defProps$1 = Object.defineProperties;
1381
1381
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1382
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1383
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1384
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1385
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1386
- var __spreadValues$2 = (a, b) => {
1382
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1383
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1384
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1385
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1386
+ var __spreadValues$3 = (a, b) => {
1387
1387
  for (var prop in b || (b = {}))
1388
- if (__hasOwnProp$2.call(b, prop))
1389
- __defNormalProp$2(a, prop, b[prop]);
1390
- if (__getOwnPropSymbols$2)
1391
- for (var prop of __getOwnPropSymbols$2(b)) {
1392
- if (__propIsEnum$2.call(b, prop))
1393
- __defNormalProp$2(a, prop, b[prop]);
1388
+ if (__hasOwnProp$3.call(b, prop))
1389
+ __defNormalProp$3(a, prop, b[prop]);
1390
+ if (__getOwnPropSymbols$3)
1391
+ for (var prop of __getOwnPropSymbols$3(b)) {
1392
+ if (__propIsEnum$3.call(b, prop))
1393
+ __defNormalProp$3(a, prop, b[prop]);
1394
1394
  }
1395
1395
  return a;
1396
1396
  };
@@ -2033,7 +2033,7 @@ const wrapWithLog = async (log, query, fn) => {
2033
2033
  if (!log) {
2034
2034
  return fn();
2035
2035
  } else {
2036
- const sql = typeof query === "string" ? { text: query, values: [] } : query.values ? query : __spreadProps$1(__spreadValues$2({}, query), { values: [] });
2036
+ const sql = typeof query === "string" ? { text: query, values: [] } : query.values ? query : __spreadProps$1(__spreadValues$3({}, query), { values: [] });
2037
2037
  const logData = log.beforeQuery(sql);
2038
2038
  try {
2039
2039
  const result = await fn();
@@ -2051,19 +2051,19 @@ const addColumn = (migration, up, tableName, columnName, fn) => {
2051
2051
  }));
2052
2052
  };
2053
2053
  const addIndex = (migration, up, tableName, columns, options) => {
2054
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.index(columns, options))));
2054
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.index(columns, options))));
2055
2055
  };
2056
2056
  const addForeignKey = (migration, up, tableName, columns, foreignTable, foreignColumns, options) => {
2057
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.foreignKey(columns, foreignTable, foreignColumns, options))));
2057
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.foreignKey(columns, foreignTable, foreignColumns, options))));
2058
2058
  };
2059
2059
  const addPrimaryKey = (migration, up, tableName, columns, options) => {
2060
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.primaryKey(columns, options))));
2060
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.primaryKey(columns, options))));
2061
2061
  };
2062
2062
  const addCheck = (migration, up, tableName, check) => {
2063
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.check(check))));
2063
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.check(check))));
2064
2064
  };
2065
2065
  const addConstraint = (migration, up, tableName, constraint) => {
2066
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.constraint(constraint))));
2066
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.constraint(constraint))));
2067
2067
  };
2068
2068
  const createSchema$1 = async (migration, up, name) => {
2069
2069
  const ast = {
@@ -2077,7 +2077,7 @@ const createSchema$1 = async (migration, up, name) => {
2077
2077
  migration.migratedAsts.push(ast);
2078
2078
  };
2079
2079
  const createExtension$1 = async (migration, up, name, options) => {
2080
- const ast = __spreadValues$2({
2080
+ const ast = __spreadValues$3({
2081
2081
  type: "extension",
2082
2082
  action: up ? "create" : "drop",
2083
2083
  name
@@ -2093,7 +2093,7 @@ const createExtension$1 = async (migration, up, name, options) => {
2093
2093
  };
2094
2094
  const createEnum$1 = async (migration, up, name, values, options = {}) => {
2095
2095
  const [schema, enumName] = getSchemaAndTableFromName(name);
2096
- const ast = __spreadValues$2({
2096
+ const ast = __spreadValues$3({
2097
2097
  type: "enum",
2098
2098
  action: up ? "create" : "drop",
2099
2099
  schema,
@@ -2112,7 +2112,7 @@ const createEnum$1 = async (migration, up, name, values, options = {}) => {
2112
2112
  };
2113
2113
  const createDomain$1 = async (migration, up, name, fn, options) => {
2114
2114
  const [schema, domainName] = getSchemaAndTableFromName(name);
2115
- const ast = __spreadValues$2({
2115
+ const ast = __spreadValues$3({
2116
2116
  type: "domain",
2117
2117
  action: up ? "create" : "drop",
2118
2118
  schema,
@@ -2140,7 +2140,7 @@ DEFAULT ${ast.default.toSQL({ values })}` : ""}${ast.notNull || ast.check ? "\n"
2140
2140
  };
2141
2141
  const createCollation$1 = async (migration, up, name, options) => {
2142
2142
  const [schema, collationName] = getSchemaAndTableFromName(name);
2143
- const ast = __spreadValues$2({
2143
+ const ast = __spreadValues$3({
2144
2144
  type: "collation",
2145
2145
  action: up ? "create" : "drop",
2146
2146
  schema,
@@ -2212,26 +2212,26 @@ const getMigratedVersionsMap = async (db, config) => {
2212
2212
  }
2213
2213
  };
2214
2214
 
2215
- var __defProp$1 = Object.defineProperty;
2216
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2217
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2218
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2219
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2220
- var __spreadValues$1 = (a, b) => {
2215
+ var __defProp$2 = Object.defineProperty;
2216
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
2217
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
2218
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
2219
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2220
+ var __spreadValues$2 = (a, b) => {
2221
2221
  for (var prop in b || (b = {}))
2222
- if (__hasOwnProp$1.call(b, prop))
2223
- __defNormalProp$1(a, prop, b[prop]);
2224
- if (__getOwnPropSymbols$1)
2225
- for (var prop of __getOwnPropSymbols$1(b)) {
2226
- if (__propIsEnum$1.call(b, prop))
2227
- __defNormalProp$1(a, prop, b[prop]);
2222
+ if (__hasOwnProp$2.call(b, prop))
2223
+ __defNormalProp$2(a, prop, b[prop]);
2224
+ if (__getOwnPropSymbols$2)
2225
+ for (var prop of __getOwnPropSymbols$2(b)) {
2226
+ if (__propIsEnum$2.call(b, prop))
2227
+ __defNormalProp$2(a, prop, b[prop]);
2228
2228
  }
2229
2229
  return a;
2230
2230
  };
2231
2231
  const getDb = (adapter) => pqb.createDb({ adapter });
2232
2232
  const migrateOrRollback = async (options, config, args, up) => {
2233
2233
  var _a, _b, _c, _d, _e, _f;
2234
- config = __spreadValues$1({}, config);
2234
+ config = __spreadValues$2({}, config);
2235
2235
  const files = await getMigrations(config, up);
2236
2236
  let count = up ? Infinity : 1;
2237
2237
  let argI = 0;
@@ -2905,21 +2905,21 @@ WHERE ${filterSchema("n.nspname")}
2905
2905
  }
2906
2906
  }
2907
2907
 
2908
- var __defProp = Object.defineProperty;
2908
+ var __defProp$1 = Object.defineProperty;
2909
2909
  var __defProps = Object.defineProperties;
2910
2910
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2911
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2912
- var __hasOwnProp = Object.prototype.hasOwnProperty;
2913
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
2914
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2915
- var __spreadValues = (a, b) => {
2911
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2912
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2913
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2914
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2915
+ var __spreadValues$1 = (a, b) => {
2916
2916
  for (var prop in b || (b = {}))
2917
- if (__hasOwnProp.call(b, prop))
2918
- __defNormalProp(a, prop, b[prop]);
2919
- if (__getOwnPropSymbols)
2920
- for (var prop of __getOwnPropSymbols(b)) {
2921
- if (__propIsEnum.call(b, prop))
2922
- __defNormalProp(a, prop, b[prop]);
2917
+ if (__hasOwnProp$1.call(b, prop))
2918
+ __defNormalProp$1(a, prop, b[prop]);
2919
+ if (__getOwnPropSymbols$1)
2920
+ for (var prop of __getOwnPropSymbols$1(b)) {
2921
+ if (__propIsEnum$1.call(b, prop))
2922
+ __defNormalProp$1(a, prop, b[prop]);
2923
2923
  }
2924
2924
  return a;
2925
2925
  };
@@ -2927,11 +2927,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2927
2927
  var __objRest = (source, exclude) => {
2928
2928
  var target = {};
2929
2929
  for (var prop in source)
2930
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
2930
+ if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
2931
2931
  target[prop] = source[prop];
2932
- if (source != null && __getOwnPropSymbols)
2933
- for (var prop of __getOwnPropSymbols(source)) {
2934
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
2932
+ if (source != null && __getOwnPropSymbols$1)
2933
+ for (var prop of __getOwnPropSymbols$1(source)) {
2934
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
2935
2935
  target[prop] = source[prop];
2936
2936
  }
2937
2937
  return target;
@@ -2962,7 +2962,7 @@ const structureToAst = async (ctx, db) => {
2962
2962
  });
2963
2963
  }
2964
2964
  for (const it of data.collations) {
2965
- ast.push(__spreadProps(__spreadValues({
2965
+ ast.push(__spreadProps(__spreadValues$1({
2966
2966
  type: "collation",
2967
2967
  action: "create"
2968
2968
  }, it), {
@@ -3057,7 +3057,7 @@ const structureToAst = async (ctx, db) => {
3057
3057
  );
3058
3058
  }
3059
3059
  for (const [fkey, table] of outerConstraints) {
3060
- ast.push(__spreadProps(__spreadValues({}, constraintToAst(ctx, fkey)), {
3060
+ ast.push(__spreadProps(__spreadValues$1({}, constraintToAst(ctx, fkey)), {
3061
3061
  type: "constraint",
3062
3062
  action: "create",
3063
3063
  tableSchema: table.schemaName === ctx.currentSchema ? void 0 : table.schemaName,
@@ -3237,7 +3237,7 @@ const pushTableAst = (ctx, ast, data, domains, table, pendingTables, innerConstr
3237
3237
  indexes: tableIndexes.filter(
3238
3238
  (index) => index.columns.length > 1 || index.columns.some((it) => "expression" in it)
3239
3239
  ).map((index) => ({
3240
- columns: index.columns.map((it) => __spreadProps(__spreadValues({}, "column" in it ? { column: it.column } : { expression: it.expression }), {
3240
+ columns: index.columns.map((it) => __spreadProps(__spreadValues$1({}, "column" in it ? { column: it.column } : { expression: it.expression }), {
3241
3241
  collate: it.collate,
3242
3242
  opclass: it.opclass,
3243
3243
  order: it.order
@@ -3337,9 +3337,9 @@ const makeColumnsShape = (ctx, data, domains, tableName, columns, primaryKey, in
3337
3337
  for (let item of columns) {
3338
3338
  const isSerial = getIsSerial(item);
3339
3339
  if (isSerial) {
3340
- item = __spreadProps(__spreadValues({}, item), { default: void 0 });
3340
+ item = __spreadProps(__spreadValues$1({}, item), { default: void 0 });
3341
3341
  }
3342
- let column = getColumn(ctx, data, domains, __spreadProps(__spreadValues({}, item), {
3342
+ let column = getColumn(ctx, data, domains, __spreadProps(__spreadValues$1({}, item), {
3343
3343
  type: item.type,
3344
3344
  isArray: item.isArray,
3345
3345
  isSerial
@@ -3754,6 +3754,22 @@ const readdirRecursive = async (dirPath, cb) => {
3754
3754
  );
3755
3755
  };
3756
3756
 
3757
+ var __defProp = Object.defineProperty;
3758
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3759
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3760
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
3761
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3762
+ var __spreadValues = (a, b) => {
3763
+ for (var prop in b || (b = {}))
3764
+ if (__hasOwnProp.call(b, prop))
3765
+ __defNormalProp(a, prop, b[prop]);
3766
+ if (__getOwnPropSymbols)
3767
+ for (var prop of __getOwnPropSymbols(b)) {
3768
+ if (__propIsEnum.call(b, prop))
3769
+ __defNormalProp(a, prop, b[prop]);
3770
+ }
3771
+ return a;
3772
+ };
3757
3773
  const rakeDb = (options, partialConfig = {}, args = process.argv.slice(2)) => {
3758
3774
  const config = processRakeDbConfig(partialConfig);
3759
3775
  const promise = runCommand(options, config, args).catch((err) => {
@@ -3772,8 +3788,8 @@ rakeDb.lazy = (options, partialConfig = {}) => {
3772
3788
  const config = processRakeDbConfig(partialConfig);
3773
3789
  return {
3774
3790
  change,
3775
- run(args) {
3776
- return runCommand(options, config, args);
3791
+ run(args, conf) {
3792
+ return runCommand(options, conf ? __spreadValues(__spreadValues({}, config), conf) : config, args);
3777
3793
  }
3778
3794
  };
3779
3795
  };