rake-db 2.10.48 → 2.10.50

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
@@ -5,21 +5,21 @@ import { readdir, mkdir, writeFile, stat, readFile } from 'fs/promises';
5
5
  import prompts from 'prompts';
6
6
  import { pathToFileURL } from 'url';
7
7
 
8
- var __defProp$6 = Object.defineProperty;
8
+ var __defProp$7 = Object.defineProperty;
9
9
  var __defProps$5 = Object.defineProperties;
10
10
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
11
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
12
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
13
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
14
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
- var __spreadValues$6 = (a, b) => {
11
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
12
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
13
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
14
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __spreadValues$7 = (a, b) => {
16
16
  for (var prop in b || (b = {}))
17
- if (__hasOwnProp$6.call(b, prop))
18
- __defNormalProp$6(a, prop, b[prop]);
19
- if (__getOwnPropSymbols$6)
20
- for (var prop of __getOwnPropSymbols$6(b)) {
21
- if (__propIsEnum$6.call(b, prop))
22
- __defNormalProp$6(a, prop, b[prop]);
17
+ if (__hasOwnProp$7.call(b, prop))
18
+ __defNormalProp$7(a, prop, b[prop]);
19
+ if (__getOwnPropSymbols$7)
20
+ for (var prop of __getOwnPropSymbols$7(b)) {
21
+ if (__propIsEnum$7.call(b, prop))
22
+ __defNormalProp$7(a, prop, b[prop]);
23
23
  }
24
24
  return a;
25
25
  };
@@ -27,11 +27,11 @@ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
27
27
  var __objRest$2 = (source, exclude) => {
28
28
  var target = {};
29
29
  for (var prop in source)
30
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
31
31
  target[prop] = source[prop];
32
- if (source != null && __getOwnPropSymbols$6)
33
- for (var prop of __getOwnPropSymbols$6(source)) {
34
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
32
+ if (source != null && __getOwnPropSymbols$7)
33
+ for (var prop of __getOwnPropSymbols$7(source)) {
34
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
35
35
  target[prop] = source[prop];
36
36
  }
37
37
  return target;
@@ -56,7 +56,7 @@ const migrationConfigDefaults = {
56
56
  };
57
57
  const processRakeDbConfig = (config) => {
58
58
  var _a;
59
- const result = __spreadValues$6(__spreadValues$6({}, migrationConfigDefaults), config);
59
+ const result = __spreadValues$7(__spreadValues$7({}, migrationConfigDefaults), config);
60
60
  if (!result.recurrentPath) {
61
61
  result.recurrentPath = path.join(result.migrationsPath, "recurrent");
62
62
  }
@@ -131,9 +131,9 @@ const setAdapterOptions = (options, set) => {
131
131
  if (set.password !== void 0) {
132
132
  url.password = set.password;
133
133
  }
134
- return __spreadProps$5(__spreadValues$6({}, options), { databaseURL: url.toString() });
134
+ return __spreadProps$5(__spreadValues$7({}, options), { databaseURL: url.toString() });
135
135
  } else {
136
- return __spreadValues$6(__spreadValues$6({}, options), set);
136
+ return __spreadValues$7(__spreadValues$7({}, options), set);
137
137
  }
138
138
  };
139
139
  const setAdminCredentialsToOptions = async (options, create) => {
@@ -162,7 +162,7 @@ const setAdminCredentialsToOptions = async (options, create) => {
162
162
  name: "password"
163
163
  }
164
164
  ]);
165
- return setAdapterOptions(options, __spreadProps$5(__spreadValues$6({}, values), {
165
+ return setAdapterOptions(options, __spreadProps$5(__spreadValues$7({}, values), {
166
166
  password: values.password || void 0
167
167
  }));
168
168
  };
@@ -227,7 +227,7 @@ const getMigrations = async (_a, up) => {
227
227
  } = _b, config = __objRest$2(_b, [
228
228
  "migrations"
229
229
  ]);
230
- return migrations ? getMigrationsFromConfig(__spreadProps$5(__spreadValues$6({}, config), { migrations }), up) : getMigrationsFromFiles(config, up);
230
+ return migrations ? getMigrationsFromConfig(__spreadProps$5(__spreadValues$7({}, config), { migrations }), up) : getMigrationsFromFiles(config, up);
231
231
  };
232
232
  function getMigrationsFromConfig(config, up) {
233
233
  const result = [];
@@ -333,21 +333,21 @@ const clearChanges = () => {
333
333
  const getCurrentChanges = () => currentChanges;
334
334
  const pushChange = (fn) => currentChanges.push(fn);
335
335
 
336
- var __defProp$5 = Object.defineProperty;
336
+ var __defProp$6 = Object.defineProperty;
337
337
  var __defProps$4 = Object.defineProperties;
338
338
  var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
339
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
340
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
341
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
342
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
343
- var __spreadValues$5 = (a, b) => {
339
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
340
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
341
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
342
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
343
+ var __spreadValues$6 = (a, b) => {
344
344
  for (var prop in b || (b = {}))
345
- if (__hasOwnProp$5.call(b, prop))
346
- __defNormalProp$5(a, prop, b[prop]);
347
- if (__getOwnPropSymbols$5)
348
- for (var prop of __getOwnPropSymbols$5(b)) {
349
- if (__propIsEnum$5.call(b, prop))
350
- __defNormalProp$5(a, prop, b[prop]);
345
+ if (__hasOwnProp$6.call(b, prop))
346
+ __defNormalProp$6(a, prop, b[prop]);
347
+ if (__getOwnPropSymbols$6)
348
+ for (var prop of __getOwnPropSymbols$6(b)) {
349
+ if (__propIsEnum$6.call(b, prop))
350
+ __defNormalProp$6(a, prop, b[prop]);
351
351
  }
352
352
  return a;
353
353
  };
@@ -445,7 +445,7 @@ const addColumnIndex = (indexes, name, item) => {
445
445
  if (item.data.indexes) {
446
446
  indexes.push(
447
447
  ...item.data.indexes.map((index) => ({
448
- columns: [__spreadProps$4(__spreadValues$5({}, index), { column: name })],
448
+ columns: [__spreadProps$4(__spreadValues$6({}, index), { column: name })],
449
449
  options: index
450
450
  }))
451
451
  );
@@ -622,21 +622,21 @@ class RakeDbError extends Error {
622
622
  class NoPrimaryKey extends RakeDbError {
623
623
  }
624
624
 
625
- var __defProp$4 = Object.defineProperty;
625
+ var __defProp$5 = Object.defineProperty;
626
626
  var __defProps$3 = Object.defineProperties;
627
627
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
628
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
629
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
630
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
631
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
632
- var __spreadValues$4 = (a, b) => {
628
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
629
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
630
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
631
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
632
+ var __spreadValues$5 = (a, b) => {
633
633
  for (var prop in b || (b = {}))
634
- if (__hasOwnProp$4.call(b, prop))
635
- __defNormalProp$4(a, prop, b[prop]);
636
- if (__getOwnPropSymbols$4)
637
- for (var prop of __getOwnPropSymbols$4(b)) {
638
- if (__propIsEnum$4.call(b, prop))
639
- __defNormalProp$4(a, prop, b[prop]);
634
+ if (__hasOwnProp$5.call(b, prop))
635
+ __defNormalProp$5(a, prop, b[prop]);
636
+ if (__getOwnPropSymbols$5)
637
+ for (var prop of __getOwnPropSymbols$5(b)) {
638
+ if (__propIsEnum$5.call(b, prop))
639
+ __defNormalProp$5(a, prop, b[prop]);
640
640
  }
641
641
  return a;
642
642
  };
@@ -644,11 +644,11 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
644
644
  var __objRest$1 = (source, exclude) => {
645
645
  var target = {};
646
646
  for (var prop in source)
647
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
647
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
648
648
  target[prop] = source[prop];
649
- if (source != null && __getOwnPropSymbols$4)
650
- for (var prop of __getOwnPropSymbols$4(source)) {
651
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
649
+ if (source != null && __getOwnPropSymbols$5)
650
+ for (var prop of __getOwnPropSymbols$5(source)) {
651
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
652
652
  target[prop] = source[prop];
653
653
  }
654
654
  return target;
@@ -704,14 +704,14 @@ const makeAst$2 = (up, tableName, shape, tableData, options, noPrimaryKey) => {
704
704
  }
705
705
  const { primaryKey } = tableData;
706
706
  const [schema, table] = getSchemaAndTableFromName(tableName);
707
- return __spreadProps$3(__spreadValues$4(__spreadProps$3(__spreadValues$4({
707
+ return __spreadProps$3(__spreadValues$5(__spreadProps$3(__spreadValues$5({
708
708
  type: "table",
709
709
  action: up ? "create" : "drop",
710
710
  schema,
711
711
  name: table,
712
712
  shape
713
713
  }, tableData), {
714
- primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$3(__spreadValues$4({}, primaryKey), { columns: [...shapePKeys, ...primaryKey.columns] }) : { columns: shapePKeys }
714
+ primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$3(__spreadValues$5({}, primaryKey), { columns: [...shapePKeys, ...primaryKey.columns] }) : { columns: shapePKeys }
715
715
  }), options), {
716
716
  noPrimaryKey: options.noPrimaryKey ? "ignore" : noPrimaryKey || "error"
717
717
  });
@@ -788,8 +788,8 @@ const astToQueries$1 = (ast, snakeCase, language) => {
788
788
  ${constraintToSql(
789
789
  ast,
790
790
  true,
791
- __spreadProps$3(__spreadValues$4({}, item), {
792
- references: item.references ? __spreadProps$3(__spreadValues$4({}, item.references), {
791
+ __spreadProps$3(__spreadValues$5({}, item), {
792
+ references: item.references ? __spreadProps$3(__spreadValues$5({}, item.references), {
793
793
  columns: item.references.columns.map(
794
794
  (column) => getColumnName(shape[column], column, snakeCase)
795
795
  )
@@ -801,8 +801,8 @@ const astToQueries$1 = (ast, snakeCase, language) => {
801
801
  );
802
802
  });
803
803
  indexes.push(
804
- ...((_b = ast.indexes) == null ? void 0 : _b.map((index) => __spreadProps$3(__spreadValues$4({}, index), {
805
- columns: index.columns.map((item) => __spreadValues$4(__spreadValues$4({}, item), "column" in item ? {
804
+ ...((_b = ast.indexes) == null ? void 0 : _b.map((index) => __spreadProps$3(__spreadValues$5({}, index), {
805
+ columns: index.columns.map((item) => __spreadValues$5(__spreadValues$5({}, item), "column" in item ? {
806
806
  column: getColumnName(shape[item.column], item.column, snakeCase)
807
807
  } : {}))
808
808
  }))) || []
@@ -824,21 +824,21 @@ const astToQueries$1 = (ast, snakeCase, language) => {
824
824
  return queries;
825
825
  };
826
826
 
827
- var __defProp$3 = Object.defineProperty;
827
+ var __defProp$4 = Object.defineProperty;
828
828
  var __defProps$2 = Object.defineProperties;
829
829
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
830
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
831
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
832
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
833
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
834
- var __spreadValues$3 = (a, b) => {
830
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
831
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
832
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
833
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
834
+ var __spreadValues$4 = (a, b) => {
835
835
  for (var prop in b || (b = {}))
836
- if (__hasOwnProp$3.call(b, prop))
837
- __defNormalProp$3(a, prop, b[prop]);
838
- if (__getOwnPropSymbols$3)
839
- for (var prop of __getOwnPropSymbols$3(b)) {
840
- if (__propIsEnum$3.call(b, prop))
841
- __defNormalProp$3(a, prop, b[prop]);
836
+ if (__hasOwnProp$4.call(b, prop))
837
+ __defNormalProp$4(a, prop, b[prop]);
838
+ if (__getOwnPropSymbols$4)
839
+ for (var prop of __getOwnPropSymbols$4(b)) {
840
+ if (__propIsEnum$4.call(b, prop))
841
+ __defNormalProp$4(a, prop, b[prop]);
842
842
  }
843
843
  return a;
844
844
  };
@@ -858,7 +858,7 @@ const mergeTableData = (a, b) => {
858
858
  } else {
859
859
  a.primaryKey = {
860
860
  columns: [...a.primaryKey.columns, ...b.primaryKey.columns],
861
- options: __spreadValues$3(__spreadValues$3({}, a.primaryKey.options), b.primaryKey.options)
861
+ options: __spreadValues$4(__spreadValues$4({}, a.primaryKey.options), b.primaryKey.options)
862
862
  };
863
863
  }
864
864
  }
@@ -921,7 +921,7 @@ const addOrDrop = (type, item, options) => {
921
921
  check: item.data.check
922
922
  }
923
923
  });
924
- return __spreadValues$3({
924
+ return __spreadValues$4({
925
925
  type: "change",
926
926
  from: type === "add" ? empty : add2,
927
927
  to: type === "add" ? add2 : empty
@@ -939,7 +939,7 @@ const columnTypeToColumnChange = (item) => {
939
939
  if (foreignKeys == null ? void 0 : foreignKeys.some((it) => "fn" in it)) {
940
940
  throw new Error("Callback in foreignKey is not allowed in migration");
941
941
  }
942
- return __spreadProps$2(__spreadValues$3({
942
+ return __spreadProps$2(__spreadValues$4({
943
943
  column: item,
944
944
  type: item.toSQL(),
945
945
  nullable: item.data.isNullable,
@@ -951,7 +951,7 @@ const columnTypeToColumnChange = (item) => {
951
951
  return item.to;
952
952
  };
953
953
  const nameKey = Symbol("name");
954
- const tableChangeMethods = __spreadProps$2(__spreadValues$3({}, tableMethods), {
954
+ const tableChangeMethods = __spreadProps$2(__spreadValues$4({}, tableMethods), {
955
955
  name(name) {
956
956
  const types = Object.create(columnTypes.name.call(this, name));
957
957
  types[nameKey] = name;
@@ -960,7 +960,7 @@ const tableChangeMethods = __spreadProps$2(__spreadValues$3({}, tableMethods), {
960
960
  add,
961
961
  drop,
962
962
  change(from, to, options) {
963
- return __spreadValues$3({
963
+ return __spreadValues$4({
964
964
  type: "change",
965
965
  name: this[nameKey],
966
966
  from: columnTypeToColumnChange(from),
@@ -1020,18 +1020,18 @@ const makeAst$1 = (up, name, changeData, changeTableData2, options) => {
1020
1020
  }
1021
1021
  if ("type" in item) {
1022
1022
  if (up) {
1023
- shape[key] = item.type === "change" && item.usingUp ? __spreadProps$2(__spreadValues$3({}, item), { using: item.usingUp }) : item;
1023
+ shape[key] = item.type === "change" && item.usingUp ? __spreadProps$2(__spreadValues$4({}, item), { using: item.usingUp }) : item;
1024
1024
  } else {
1025
1025
  if (item.type === "rename") {
1026
- shape[item.name] = __spreadProps$2(__spreadValues$3({}, item), { name: key });
1026
+ shape[item.name] = __spreadProps$2(__spreadValues$4({}, item), { name: key });
1027
1027
  } else {
1028
- 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;
1028
+ 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;
1029
1029
  }
1030
1030
  }
1031
1031
  }
1032
1032
  }
1033
1033
  const [schema, table] = getSchemaAndTableFromName(name);
1034
- return __spreadValues$3({
1034
+ return __spreadValues$4({
1035
1035
  type: "changeTable",
1036
1036
  schema,
1037
1037
  name: table,
@@ -1225,7 +1225,7 @@ const astToQueries = (ast, snakeCase, language) => {
1225
1225
  if (fromIndex) {
1226
1226
  dropIndexes.push({
1227
1227
  columns: [
1228
- __spreadValues$3({
1228
+ __spreadValues$4({
1229
1229
  column: name
1230
1230
  }, fromIndex)
1231
1231
  ],
@@ -1235,7 +1235,7 @@ const astToQueries = (ast, snakeCase, language) => {
1235
1235
  if (toIndex) {
1236
1236
  addIndexes.push({
1237
1237
  columns: [
1238
- __spreadValues$3({
1238
+ __spreadValues$4({
1239
1239
  column: name
1240
1240
  }, toIndex)
1241
1241
  ],
@@ -1300,13 +1300,13 @@ const mapIndexesForSnakeCase = (indexes, snakeCase) => {
1300
1300
  return (indexes == null ? void 0 : indexes.map((index) => ({
1301
1301
  options: index.options,
1302
1302
  columns: snakeCase ? index.columns.map(
1303
- (item) => "column" in item ? __spreadProps$2(__spreadValues$3({}, item), { column: toSnakeCase(item.column) }) : item
1303
+ (item) => "column" in item ? __spreadProps$2(__spreadValues$4({}, item), { column: toSnakeCase(item.column) }) : item
1304
1304
  ) : index.columns
1305
1305
  }))) || [];
1306
1306
  };
1307
1307
  const mapConstraintsToSnakeCase = (foreignKeys, snakeCase) => {
1308
- return (foreignKeys == null ? void 0 : foreignKeys.map((item) => __spreadProps$2(__spreadValues$3({}, item), {
1309
- references: item.references ? snakeCase ? __spreadProps$2(__spreadValues$3({}, item.references), {
1308
+ return (foreignKeys == null ? void 0 : foreignKeys.map((item) => __spreadProps$2(__spreadValues$4({}, item), {
1309
+ references: item.references ? snakeCase ? __spreadProps$2(__spreadValues$4({}, item.references), {
1310
1310
  columns: item.references.columns.map(toSnakeCase)
1311
1311
  }) : item.references : void 0
1312
1312
  }))) || [];
@@ -1374,21 +1374,21 @@ const astToQuery = (ast) => {
1374
1374
  };
1375
1375
  };
1376
1376
 
1377
- var __defProp$2 = Object.defineProperty;
1377
+ var __defProp$3 = Object.defineProperty;
1378
1378
  var __defProps$1 = Object.defineProperties;
1379
1379
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1380
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
1381
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
1382
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
1383
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1384
- var __spreadValues$2 = (a, b) => {
1380
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1381
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1382
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1383
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1384
+ var __spreadValues$3 = (a, b) => {
1385
1385
  for (var prop in b || (b = {}))
1386
- if (__hasOwnProp$2.call(b, prop))
1387
- __defNormalProp$2(a, prop, b[prop]);
1388
- if (__getOwnPropSymbols$2)
1389
- for (var prop of __getOwnPropSymbols$2(b)) {
1390
- if (__propIsEnum$2.call(b, prop))
1391
- __defNormalProp$2(a, prop, b[prop]);
1386
+ if (__hasOwnProp$3.call(b, prop))
1387
+ __defNormalProp$3(a, prop, b[prop]);
1388
+ if (__getOwnPropSymbols$3)
1389
+ for (var prop of __getOwnPropSymbols$3(b)) {
1390
+ if (__propIsEnum$3.call(b, prop))
1391
+ __defNormalProp$3(a, prop, b[prop]);
1392
1392
  }
1393
1393
  return a;
1394
1394
  };
@@ -2031,7 +2031,7 @@ const wrapWithLog = async (log, query, fn) => {
2031
2031
  if (!log) {
2032
2032
  return fn();
2033
2033
  } else {
2034
- const sql = typeof query === "string" ? { text: query, values: [] } : query.values ? query : __spreadProps$1(__spreadValues$2({}, query), { values: [] });
2034
+ const sql = typeof query === "string" ? { text: query, values: [] } : query.values ? query : __spreadProps$1(__spreadValues$3({}, query), { values: [] });
2035
2035
  const logData = log.beforeQuery(sql);
2036
2036
  try {
2037
2037
  const result = await fn();
@@ -2049,19 +2049,19 @@ const addColumn = (migration, up, tableName, columnName, fn) => {
2049
2049
  }));
2050
2050
  };
2051
2051
  const addIndex = (migration, up, tableName, columns, options) => {
2052
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.index(columns, options))));
2052
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.index(columns, options))));
2053
2053
  };
2054
2054
  const addForeignKey = (migration, up, tableName, columns, foreignTable, foreignColumns, options) => {
2055
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.foreignKey(columns, foreignTable, foreignColumns, options))));
2055
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.foreignKey(columns, foreignTable, foreignColumns, options))));
2056
2056
  };
2057
2057
  const addPrimaryKey = (migration, up, tableName, columns, options) => {
2058
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.primaryKey(columns, options))));
2058
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.primaryKey(columns, options))));
2059
2059
  };
2060
2060
  const addCheck = (migration, up, tableName, check) => {
2061
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.check(check))));
2061
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.check(check))));
2062
2062
  };
2063
2063
  const addConstraint = (migration, up, tableName, constraint) => {
2064
- return changeTable(migration, up, tableName, {}, (t) => __spreadValues$2({}, t.add(t.constraint(constraint))));
2064
+ return changeTable(migration, up, tableName, {}, (t) => __spreadValues$3({}, t.add(t.constraint(constraint))));
2065
2065
  };
2066
2066
  const createSchema$1 = async (migration, up, name) => {
2067
2067
  const ast = {
@@ -2075,7 +2075,7 @@ const createSchema$1 = async (migration, up, name) => {
2075
2075
  migration.migratedAsts.push(ast);
2076
2076
  };
2077
2077
  const createExtension$1 = async (migration, up, name, options) => {
2078
- const ast = __spreadValues$2({
2078
+ const ast = __spreadValues$3({
2079
2079
  type: "extension",
2080
2080
  action: up ? "create" : "drop",
2081
2081
  name
@@ -2091,7 +2091,7 @@ const createExtension$1 = async (migration, up, name, options) => {
2091
2091
  };
2092
2092
  const createEnum$1 = async (migration, up, name, values, options = {}) => {
2093
2093
  const [schema, enumName] = getSchemaAndTableFromName(name);
2094
- const ast = __spreadValues$2({
2094
+ const ast = __spreadValues$3({
2095
2095
  type: "enum",
2096
2096
  action: up ? "create" : "drop",
2097
2097
  schema,
@@ -2110,7 +2110,7 @@ const createEnum$1 = async (migration, up, name, values, options = {}) => {
2110
2110
  };
2111
2111
  const createDomain$1 = async (migration, up, name, fn, options) => {
2112
2112
  const [schema, domainName] = getSchemaAndTableFromName(name);
2113
- const ast = __spreadValues$2({
2113
+ const ast = __spreadValues$3({
2114
2114
  type: "domain",
2115
2115
  action: up ? "create" : "drop",
2116
2116
  schema,
@@ -2138,7 +2138,7 @@ DEFAULT ${ast.default.toSQL({ values })}` : ""}${ast.notNull || ast.check ? "\n"
2138
2138
  };
2139
2139
  const createCollation$1 = async (migration, up, name, options) => {
2140
2140
  const [schema, collationName] = getSchemaAndTableFromName(name);
2141
- const ast = __spreadValues$2({
2141
+ const ast = __spreadValues$3({
2142
2142
  type: "collation",
2143
2143
  action: up ? "create" : "drop",
2144
2144
  schema,
@@ -2210,26 +2210,26 @@ const getMigratedVersionsMap = async (db, config) => {
2210
2210
  }
2211
2211
  };
2212
2212
 
2213
- var __defProp$1 = Object.defineProperty;
2214
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2215
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2216
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2217
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2218
- var __spreadValues$1 = (a, b) => {
2213
+ var __defProp$2 = Object.defineProperty;
2214
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
2215
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
2216
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
2217
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2218
+ var __spreadValues$2 = (a, b) => {
2219
2219
  for (var prop in b || (b = {}))
2220
- if (__hasOwnProp$1.call(b, prop))
2221
- __defNormalProp$1(a, prop, b[prop]);
2222
- if (__getOwnPropSymbols$1)
2223
- for (var prop of __getOwnPropSymbols$1(b)) {
2224
- if (__propIsEnum$1.call(b, prop))
2225
- __defNormalProp$1(a, prop, b[prop]);
2220
+ if (__hasOwnProp$2.call(b, prop))
2221
+ __defNormalProp$2(a, prop, b[prop]);
2222
+ if (__getOwnPropSymbols$2)
2223
+ for (var prop of __getOwnPropSymbols$2(b)) {
2224
+ if (__propIsEnum$2.call(b, prop))
2225
+ __defNormalProp$2(a, prop, b[prop]);
2226
2226
  }
2227
2227
  return a;
2228
2228
  };
2229
2229
  const getDb = (adapter) => createDb$1({ adapter });
2230
2230
  const migrateOrRollback = async (options, config, args, up) => {
2231
2231
  var _a, _b, _c, _d, _e, _f;
2232
- config = __spreadValues$1({}, config);
2232
+ config = __spreadValues$2({}, config);
2233
2233
  const files = await getMigrations(config, up);
2234
2234
  let count = up ? Infinity : 1;
2235
2235
  let argI = 0;
@@ -2903,21 +2903,21 @@ WHERE ${filterSchema("n.nspname")}
2903
2903
  }
2904
2904
  }
2905
2905
 
2906
- var __defProp = Object.defineProperty;
2906
+ var __defProp$1 = Object.defineProperty;
2907
2907
  var __defProps = Object.defineProperties;
2908
2908
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2909
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2910
- var __hasOwnProp = Object.prototype.hasOwnProperty;
2911
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
2912
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2913
- var __spreadValues = (a, b) => {
2909
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2910
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2911
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2912
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2913
+ var __spreadValues$1 = (a, b) => {
2914
2914
  for (var prop in b || (b = {}))
2915
- if (__hasOwnProp.call(b, prop))
2916
- __defNormalProp(a, prop, b[prop]);
2917
- if (__getOwnPropSymbols)
2918
- for (var prop of __getOwnPropSymbols(b)) {
2919
- if (__propIsEnum.call(b, prop))
2920
- __defNormalProp(a, prop, b[prop]);
2915
+ if (__hasOwnProp$1.call(b, prop))
2916
+ __defNormalProp$1(a, prop, b[prop]);
2917
+ if (__getOwnPropSymbols$1)
2918
+ for (var prop of __getOwnPropSymbols$1(b)) {
2919
+ if (__propIsEnum$1.call(b, prop))
2920
+ __defNormalProp$1(a, prop, b[prop]);
2921
2921
  }
2922
2922
  return a;
2923
2923
  };
@@ -2925,11 +2925,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2925
2925
  var __objRest = (source, exclude) => {
2926
2926
  var target = {};
2927
2927
  for (var prop in source)
2928
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
2928
+ if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
2929
2929
  target[prop] = source[prop];
2930
- if (source != null && __getOwnPropSymbols)
2931
- for (var prop of __getOwnPropSymbols(source)) {
2932
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
2930
+ if (source != null && __getOwnPropSymbols$1)
2931
+ for (var prop of __getOwnPropSymbols$1(source)) {
2932
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
2933
2933
  target[prop] = source[prop];
2934
2934
  }
2935
2935
  return target;
@@ -2960,7 +2960,7 @@ const structureToAst = async (ctx, db) => {
2960
2960
  });
2961
2961
  }
2962
2962
  for (const it of data.collations) {
2963
- ast.push(__spreadProps(__spreadValues({
2963
+ ast.push(__spreadProps(__spreadValues$1({
2964
2964
  type: "collation",
2965
2965
  action: "create"
2966
2966
  }, it), {
@@ -3055,7 +3055,7 @@ const structureToAst = async (ctx, db) => {
3055
3055
  );
3056
3056
  }
3057
3057
  for (const [fkey, table] of outerConstraints) {
3058
- ast.push(__spreadProps(__spreadValues({}, constraintToAst(ctx, fkey)), {
3058
+ ast.push(__spreadProps(__spreadValues$1({}, constraintToAst(ctx, fkey)), {
3059
3059
  type: "constraint",
3060
3060
  action: "create",
3061
3061
  tableSchema: table.schemaName === ctx.currentSchema ? void 0 : table.schemaName,
@@ -3235,7 +3235,7 @@ const pushTableAst = (ctx, ast, data, domains, table, pendingTables, innerConstr
3235
3235
  indexes: tableIndexes.filter(
3236
3236
  (index) => index.columns.length > 1 || index.columns.some((it) => "expression" in it)
3237
3237
  ).map((index) => ({
3238
- columns: index.columns.map((it) => __spreadProps(__spreadValues({}, "column" in it ? { column: it.column } : { expression: it.expression }), {
3238
+ columns: index.columns.map((it) => __spreadProps(__spreadValues$1({}, "column" in it ? { column: it.column } : { expression: it.expression }), {
3239
3239
  collate: it.collate,
3240
3240
  opclass: it.opclass,
3241
3241
  order: it.order
@@ -3335,9 +3335,9 @@ const makeColumnsShape = (ctx, data, domains, tableName, columns, primaryKey, in
3335
3335
  for (let item of columns) {
3336
3336
  const isSerial = getIsSerial(item);
3337
3337
  if (isSerial) {
3338
- item = __spreadProps(__spreadValues({}, item), { default: void 0 });
3338
+ item = __spreadProps(__spreadValues$1({}, item), { default: void 0 });
3339
3339
  }
3340
- let column = getColumn(ctx, data, domains, __spreadProps(__spreadValues({}, item), {
3340
+ let column = getColumn(ctx, data, domains, __spreadProps(__spreadValues$1({}, item), {
3341
3341
  type: item.type,
3342
3342
  isArray: item.isArray,
3343
3343
  isSerial
@@ -3752,6 +3752,22 @@ const readdirRecursive = async (dirPath, cb) => {
3752
3752
  );
3753
3753
  };
3754
3754
 
3755
+ var __defProp = Object.defineProperty;
3756
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3757
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3758
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
3759
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3760
+ var __spreadValues = (a, b) => {
3761
+ for (var prop in b || (b = {}))
3762
+ if (__hasOwnProp.call(b, prop))
3763
+ __defNormalProp(a, prop, b[prop]);
3764
+ if (__getOwnPropSymbols)
3765
+ for (var prop of __getOwnPropSymbols(b)) {
3766
+ if (__propIsEnum.call(b, prop))
3767
+ __defNormalProp(a, prop, b[prop]);
3768
+ }
3769
+ return a;
3770
+ };
3755
3771
  const rakeDb = (options, partialConfig = {}, args = process.argv.slice(2)) => {
3756
3772
  const config = processRakeDbConfig(partialConfig);
3757
3773
  const promise = runCommand(options, config, args).catch((err) => {
@@ -3770,8 +3786,8 @@ rakeDb.lazy = (options, partialConfig = {}) => {
3770
3786
  const config = processRakeDbConfig(partialConfig);
3771
3787
  return {
3772
3788
  change,
3773
- run(args) {
3774
- return runCommand(options, config, args);
3789
+ run(args, conf) {
3790
+ return runCommand(options, conf ? __spreadValues(__spreadValues({}, config), conf) : config, args);
3775
3791
  }
3776
3792
  };
3777
3793
  };