drizzle-kit 0.12.6 → 0.12.8

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.
Files changed (2) hide show
  1. package/index.js +174 -164
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -26,9 +26,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
 
29
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/error.js
29
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/error.js
30
30
  var require_error = __commonJS({
31
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/error.js"(exports) {
31
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/error.js"(exports) {
32
32
  var CommanderError2 = class extends Error {
33
33
  constructor(exitCode, code, message) {
34
34
  super(message);
@@ -51,9 +51,9 @@ var require_error = __commonJS({
51
51
  }
52
52
  });
53
53
 
54
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/argument.js
54
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/argument.js
55
55
  var require_argument = __commonJS({
56
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/argument.js"(exports) {
56
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/argument.js"(exports) {
57
57
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
58
58
  var Argument2 = class {
59
59
  constructor(name, description) {
@@ -131,9 +131,9 @@ var require_argument = __commonJS({
131
131
  }
132
132
  });
133
133
 
134
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/help.js
134
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/help.js
135
135
  var require_help = __commonJS({
136
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/help.js"(exports) {
136
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/help.js"(exports) {
137
137
  var { humanReadableArgName } = require_argument();
138
138
  var Help2 = class {
139
139
  constructor() {
@@ -349,9 +349,9 @@ var require_help = __commonJS({
349
349
  }
350
350
  });
351
351
 
352
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/option.js
352
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/option.js
353
353
  var require_option = __commonJS({
354
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/option.js"(exports) {
354
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/option.js"(exports) {
355
355
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
356
356
  var Option2 = class {
357
357
  constructor(flags, description) {
@@ -497,9 +497,9 @@ var require_option = __commonJS({
497
497
  }
498
498
  });
499
499
 
500
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/suggestSimilar.js
500
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/suggestSimilar.js
501
501
  var require_suggestSimilar = __commonJS({
502
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/suggestSimilar.js"(exports) {
502
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/suggestSimilar.js"(exports) {
503
503
  var maxDistance = 3;
504
504
  function editDistance(a, b) {
505
505
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -576,9 +576,9 @@ var require_suggestSimilar = __commonJS({
576
576
  }
577
577
  });
578
578
 
579
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/command.js
579
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/command.js
580
580
  var require_command = __commonJS({
581
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/lib/command.js"(exports) {
581
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/command.js"(exports) {
582
582
  var EventEmitter = require("events").EventEmitter;
583
583
  var childProcess = require("child_process");
584
584
  var path3 = require("path");
@@ -945,15 +945,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
945
945
  return this._optionValues[key];
946
946
  }
947
947
  setOptionValue(key, value) {
948
+ return this.setOptionValueWithSource(key, value, void 0);
949
+ }
950
+ setOptionValueWithSource(key, value, source) {
948
951
  if (this._storeOptionsAsProperties) {
949
952
  this[key] = value;
950
953
  } else {
951
954
  this._optionValues[key] = value;
952
955
  }
953
- return this;
954
- }
955
- setOptionValueWithSource(key, value, source) {
956
- this.setOptionValue(key, value);
957
956
  this._optionValueSources[key] = source;
958
957
  return this;
959
958
  }
@@ -1757,9 +1756,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1757
1756
  }
1758
1757
  });
1759
1758
 
1760
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/index.js
1759
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/index.js
1761
1760
  var require_commander = __commonJS({
1762
- "node_modules/.pnpm/commander@9.4.0/node_modules/commander/index.js"(exports, module2) {
1761
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/index.js"(exports, module2) {
1763
1762
  var { Argument: Argument2 } = require_argument();
1764
1763
  var { Command: Command2 } = require_command();
1765
1764
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -1777,9 +1776,9 @@ var require_commander = __commonJS({
1777
1776
  }
1778
1777
  });
1779
1778
 
1780
- // node_modules/.pnpm/esbuild-register@3.3.3_esbuild@0.15.7/node_modules/esbuild-register/dist/node.js
1779
+ // node_modules/.pnpm/esbuild-register@3.3.3_esbuild@0.15.12/node_modules/esbuild-register/dist/node.js
1781
1780
  var require_node = __commonJS({
1782
- "node_modules/.pnpm/esbuild-register@3.3.3_esbuild@0.15.7/node_modules/esbuild-register/dist/node.js"(exports) {
1781
+ "node_modules/.pnpm/esbuild-register@3.3.3_esbuild@0.15.12/node_modules/esbuild-register/dist/node.js"(exports) {
1783
1782
  "use strict";
1784
1783
  Object.defineProperty(exports, "__esModule", { value: true });
1785
1784
  function _interopRequireDefault2(obj) {
@@ -15043,7 +15042,7 @@ __export(cli_exports, {
15043
15042
  });
15044
15043
  module.exports = __toCommonJS(cli_exports);
15045
15044
 
15046
- // node_modules/.pnpm/commander@9.4.0/node_modules/commander/esm.mjs
15045
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/esm.mjs
15047
15046
  var import_index = __toESM(require_commander(), 1);
15048
15047
  var {
15049
15048
  program,
@@ -15060,12 +15059,12 @@ var {
15060
15059
  } = import_index.default;
15061
15060
 
15062
15061
  // src/cli/commands/migrate.ts
15063
- var import_fs3 = __toESM(require("fs"));
15062
+ var import_fs4 = __toESM(require("fs"));
15064
15063
 
15065
15064
  // src/migrationPreparator.ts
15066
- var import_fs2 = __toESM(require("fs"));
15065
+ var import_fs3 = __toESM(require("fs"));
15067
15066
 
15068
- // node_modules/.pnpm/zod@3.18.0/node_modules/zod/lib/index.mjs
15067
+ // node_modules/.pnpm/zod@3.19.1/node_modules/zod/lib/index.mjs
15069
15068
  var util;
15070
15069
  (function(util2) {
15071
15070
  util2.assertEqual = (val) => val;
@@ -15117,6 +15116,12 @@ var util;
15117
15116
  return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
15118
15117
  }
15119
15118
  util2.joinValues = joinValues;
15119
+ util2.jsonStringifyReplacer = (_, value) => {
15120
+ if (typeof value === "bigint") {
15121
+ return value.toString();
15122
+ }
15123
+ return value;
15124
+ };
15120
15125
  })(util || (util = {}));
15121
15126
  var ZodParsedType = util.arrayToEnum([
15122
15127
  "string",
@@ -15258,7 +15263,7 @@ var ZodError = class extends Error {
15258
15263
  return this.message;
15259
15264
  }
15260
15265
  get message() {
15261
- return JSON.stringify(this.issues, jsonStringifyReplacer, 2);
15266
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
15262
15267
  }
15263
15268
  get isEmpty() {
15264
15269
  return this.issues.length === 0;
@@ -15284,7 +15289,7 @@ ZodError.create = (issues) => {
15284
15289
  const error2 = new ZodError(issues);
15285
15290
  return error2;
15286
15291
  };
15287
- var defaultErrorMap = (issue, _ctx) => {
15292
+ var errorMap = (issue, _ctx) => {
15288
15293
  let message;
15289
15294
  switch (issue.code) {
15290
15295
  case ZodIssueCode.invalid_type:
@@ -15295,7 +15300,7 @@ var defaultErrorMap = (issue, _ctx) => {
15295
15300
  }
15296
15301
  break;
15297
15302
  case ZodIssueCode.invalid_literal:
15298
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, jsonStringifyReplacer)}`;
15303
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
15299
15304
  break;
15300
15305
  case ZodIssueCode.unrecognized_keys:
15301
15306
  message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
@@ -15372,7 +15377,7 @@ var defaultErrorMap = (issue, _ctx) => {
15372
15377
  }
15373
15378
  return { message };
15374
15379
  };
15375
- var overrideErrorMap = defaultErrorMap;
15380
+ var overrideErrorMap = errorMap;
15376
15381
  function getErrorMap() {
15377
15382
  return overrideErrorMap;
15378
15383
  }
@@ -15403,7 +15408,7 @@ function addIssueToContext(ctx, issueData) {
15403
15408
  ctx.common.contextualErrorMap,
15404
15409
  ctx.schemaErrorMap,
15405
15410
  getErrorMap(),
15406
- defaultErrorMap
15411
+ errorMap
15407
15412
  ].filter((x) => !!x)
15408
15413
  });
15409
15414
  ctx.common.issues.push(issue);
@@ -15468,12 +15473,6 @@ var isAborted = (x) => x.status === "aborted";
15468
15473
  var isDirty = (x) => x.status === "dirty";
15469
15474
  var isValid = (x) => x.status === "valid";
15470
15475
  var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
15471
- var jsonStringifyReplacer = (_, value) => {
15472
- if (typeof value === "bigint") {
15473
- return value.toString();
15474
- }
15475
- return value;
15476
- };
15477
15476
  var errorUtil;
15478
15477
  (function(errorUtil2) {
15479
15478
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -15504,12 +15503,12 @@ var handleResult = (ctx, result) => {
15504
15503
  function processCreateParams(params) {
15505
15504
  if (!params)
15506
15505
  return {};
15507
- const { errorMap, invalid_type_error, required_error, description } = params;
15508
- if (errorMap && (invalid_type_error || required_error)) {
15509
- throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);
15506
+ const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
15507
+ if (errorMap2 && (invalid_type_error || required_error)) {
15508
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
15510
15509
  }
15511
- if (errorMap)
15512
- return { errorMap, description };
15510
+ if (errorMap2)
15511
+ return { errorMap: errorMap2, description };
15513
15512
  const customMap = (iss, ctx) => {
15514
15513
  if (iss.code !== "invalid_type")
15515
15514
  return { message: ctx.defaultError };
@@ -16570,9 +16569,11 @@ var ZodObject = class extends ZodType {
16570
16569
  const { status, ctx } = this._processInputParams(input);
16571
16570
  const { shape, keys: shapeKeys } = this._getCached();
16572
16571
  const extraKeys = [];
16573
- for (const key in ctx.data) {
16574
- if (!shapeKeys.includes(key)) {
16575
- extraKeys.push(key);
16572
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
16573
+ for (const key in ctx.data) {
16574
+ if (!shapeKeys.includes(key)) {
16575
+ extraKeys.push(key);
16576
+ }
16576
16577
  }
16577
16578
  }
16578
16579
  const pairs = [];
@@ -17092,6 +17093,9 @@ var ZodTuple = class extends ZodType {
17092
17093
  }
17093
17094
  };
17094
17095
  ZodTuple.create = (schemas, params) => {
17096
+ if (!Array.isArray(schemas)) {
17097
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
17098
+ }
17095
17099
  return new ZodTuple({
17096
17100
  items: schemas,
17097
17101
  typeName: ZodFirstPartyTypeKind.ZodTuple,
@@ -17317,7 +17321,7 @@ var ZodFunction = class extends ZodType {
17317
17321
  ctx.common.contextualErrorMap,
17318
17322
  ctx.schemaErrorMap,
17319
17323
  getErrorMap(),
17320
- defaultErrorMap
17324
+ errorMap
17321
17325
  ].filter((x) => !!x),
17322
17326
  issueData: {
17323
17327
  code: ZodIssueCode.invalid_arguments,
@@ -17333,7 +17337,7 @@ var ZodFunction = class extends ZodType {
17333
17337
  ctx.common.contextualErrorMap,
17334
17338
  ctx.schemaErrorMap,
17335
17339
  getErrorMap(),
17336
- defaultErrorMap
17340
+ errorMap
17337
17341
  ].filter((x) => !!x),
17338
17342
  issueData: {
17339
17343
  code: ZodIssueCode.invalid_return_type,
@@ -17398,14 +17402,14 @@ var ZodFunction = class extends ZodType {
17398
17402
  const validatedFunc = this.parse(func);
17399
17403
  return validatedFunc;
17400
17404
  }
17401
- };
17402
- ZodFunction.create = (args, returns, params) => {
17403
- return new ZodFunction({
17404
- args: args ? args.rest(ZodUnknown.create()) : ZodTuple.create([]).rest(ZodUnknown.create()),
17405
- returns: returns || ZodUnknown.create(),
17406
- typeName: ZodFirstPartyTypeKind.ZodFunction,
17407
- ...processCreateParams(params)
17408
- });
17405
+ static create(args, returns, params) {
17406
+ return new ZodFunction({
17407
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
17408
+ returns: returns || ZodUnknown.create(),
17409
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
17410
+ ...processCreateParams(params)
17411
+ });
17412
+ }
17409
17413
  };
17410
17414
  var ZodLazy = class extends ZodType {
17411
17415
  get schema() {
@@ -18642,8 +18646,8 @@ function diffForRenamedColumn(t1, t2) {
18642
18646
  return alternationsInColumn(diffed);
18643
18647
  }
18644
18648
  function applyJsonDiff(json1, json2) {
18645
- json1 = structuredClone(json1);
18646
- json2 = structuredClone(json2);
18649
+ json1 = JSON.parse(JSON.stringify(json1));
18650
+ json2 = JSON.parse(JSON.stringify(json2));
18647
18651
  const rawDiff = (0, import_json_diff.diff)(json1, json2);
18648
18652
  const difference = rawDiff;
18649
18653
  if (!difference)
@@ -19043,6 +19047,7 @@ var MySqlSquasher = {
19043
19047
  };
19044
19048
 
19045
19049
  // src/snapshotsDiffer.ts
19050
+ var import_fs2 = require("fs");
19046
19051
  var originUUID = "00000000-0000-0000-0000-000000000000";
19047
19052
  var dryPg = schema.parse({
19048
19053
  version: "3",
@@ -19186,6 +19191,7 @@ var applySnapshotsDiff = async (json1, json2, tablesResolver, columnsResolver, d
19186
19191
  if (Object.keys(diffResult).length === 0) {
19187
19192
  return "";
19188
19193
  }
19194
+ (0, import_fs2.writeFileSync)("oleksi.json", JSON.stringify(diffResult));
19189
19195
  const typedResult = diffResultScheme.parse(diffResult);
19190
19196
  const { created, deleted, renamed } = await tablesResolver({
19191
19197
  created: typedResult.addedTables,
@@ -19292,95 +19298,99 @@ var applySnapshotsDiff = async (json1, json2, tablesResolver, columnsResolver, d
19292
19298
  // src/migrationPreparator.ts
19293
19299
  var import_hanji2 = __toESM(require_hanji());
19294
19300
 
19295
- // node_modules/.pnpm/chalk@5.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js
19301
+ // node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/vendor/ansi-styles/index.js
19296
19302
  var ANSI_BACKGROUND_OFFSET = 10;
19297
19303
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
19298
19304
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
19299
19305
  var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
19306
+ var styles = {
19307
+ modifier: {
19308
+ reset: [0, 0],
19309
+ bold: [1, 22],
19310
+ dim: [2, 22],
19311
+ italic: [3, 23],
19312
+ underline: [4, 24],
19313
+ overline: [53, 55],
19314
+ inverse: [7, 27],
19315
+ hidden: [8, 28],
19316
+ strikethrough: [9, 29]
19317
+ },
19318
+ color: {
19319
+ black: [30, 39],
19320
+ red: [31, 39],
19321
+ green: [32, 39],
19322
+ yellow: [33, 39],
19323
+ blue: [34, 39],
19324
+ magenta: [35, 39],
19325
+ cyan: [36, 39],
19326
+ white: [37, 39],
19327
+ blackBright: [90, 39],
19328
+ gray: [90, 39],
19329
+ grey: [90, 39],
19330
+ redBright: [91, 39],
19331
+ greenBright: [92, 39],
19332
+ yellowBright: [93, 39],
19333
+ blueBright: [94, 39],
19334
+ magentaBright: [95, 39],
19335
+ cyanBright: [96, 39],
19336
+ whiteBright: [97, 39]
19337
+ },
19338
+ bgColor: {
19339
+ bgBlack: [40, 49],
19340
+ bgRed: [41, 49],
19341
+ bgGreen: [42, 49],
19342
+ bgYellow: [43, 49],
19343
+ bgBlue: [44, 49],
19344
+ bgMagenta: [45, 49],
19345
+ bgCyan: [46, 49],
19346
+ bgWhite: [47, 49],
19347
+ bgBlackBright: [100, 49],
19348
+ bgGray: [100, 49],
19349
+ bgGrey: [100, 49],
19350
+ bgRedBright: [101, 49],
19351
+ bgGreenBright: [102, 49],
19352
+ bgYellowBright: [103, 49],
19353
+ bgBlueBright: [104, 49],
19354
+ bgMagentaBright: [105, 49],
19355
+ bgCyanBright: [106, 49],
19356
+ bgWhiteBright: [107, 49]
19357
+ }
19358
+ };
19359
+ var modifierNames = Object.keys(styles.modifier);
19360
+ var foregroundColorNames = Object.keys(styles.color);
19361
+ var backgroundColorNames = Object.keys(styles.bgColor);
19362
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
19300
19363
  function assembleStyles() {
19301
19364
  const codes = /* @__PURE__ */ new Map();
19302
- const styles2 = {
19303
- modifier: {
19304
- reset: [0, 0],
19305
- bold: [1, 22],
19306
- dim: [2, 22],
19307
- italic: [3, 23],
19308
- underline: [4, 24],
19309
- overline: [53, 55],
19310
- inverse: [7, 27],
19311
- hidden: [8, 28],
19312
- strikethrough: [9, 29]
19313
- },
19314
- color: {
19315
- black: [30, 39],
19316
- red: [31, 39],
19317
- green: [32, 39],
19318
- yellow: [33, 39],
19319
- blue: [34, 39],
19320
- magenta: [35, 39],
19321
- cyan: [36, 39],
19322
- white: [37, 39],
19323
- blackBright: [90, 39],
19324
- redBright: [91, 39],
19325
- greenBright: [92, 39],
19326
- yellowBright: [93, 39],
19327
- blueBright: [94, 39],
19328
- magentaBright: [95, 39],
19329
- cyanBright: [96, 39],
19330
- whiteBright: [97, 39]
19331
- },
19332
- bgColor: {
19333
- bgBlack: [40, 49],
19334
- bgRed: [41, 49],
19335
- bgGreen: [42, 49],
19336
- bgYellow: [43, 49],
19337
- bgBlue: [44, 49],
19338
- bgMagenta: [45, 49],
19339
- bgCyan: [46, 49],
19340
- bgWhite: [47, 49],
19341
- bgBlackBright: [100, 49],
19342
- bgRedBright: [101, 49],
19343
- bgGreenBright: [102, 49],
19344
- bgYellowBright: [103, 49],
19345
- bgBlueBright: [104, 49],
19346
- bgMagentaBright: [105, 49],
19347
- bgCyanBright: [106, 49],
19348
- bgWhiteBright: [107, 49]
19349
- }
19350
- };
19351
- styles2.color.gray = styles2.color.blackBright;
19352
- styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
19353
- styles2.color.grey = styles2.color.blackBright;
19354
- styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
19355
- for (const [groupName, group] of Object.entries(styles2)) {
19365
+ for (const [groupName, group] of Object.entries(styles)) {
19356
19366
  for (const [styleName, style] of Object.entries(group)) {
19357
- styles2[styleName] = {
19367
+ styles[styleName] = {
19358
19368
  open: `\x1B[${style[0]}m`,
19359
19369
  close: `\x1B[${style[1]}m`
19360
19370
  };
19361
- group[styleName] = styles2[styleName];
19371
+ group[styleName] = styles[styleName];
19362
19372
  codes.set(style[0], style[1]);
19363
19373
  }
19364
- Object.defineProperty(styles2, groupName, {
19374
+ Object.defineProperty(styles, groupName, {
19365
19375
  value: group,
19366
19376
  enumerable: false
19367
19377
  });
19368
19378
  }
19369
- Object.defineProperty(styles2, "codes", {
19379
+ Object.defineProperty(styles, "codes", {
19370
19380
  value: codes,
19371
19381
  enumerable: false
19372
19382
  });
19373
- styles2.color.close = "\x1B[39m";
19374
- styles2.bgColor.close = "\x1B[49m";
19375
- styles2.color.ansi = wrapAnsi16();
19376
- styles2.color.ansi256 = wrapAnsi256();
19377
- styles2.color.ansi16m = wrapAnsi16m();
19378
- styles2.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
19379
- styles2.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
19380
- styles2.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
19381
- Object.defineProperties(styles2, {
19383
+ styles.color.close = "\x1B[39m";
19384
+ styles.bgColor.close = "\x1B[49m";
19385
+ styles.color.ansi = wrapAnsi16();
19386
+ styles.color.ansi256 = wrapAnsi256();
19387
+ styles.color.ansi16m = wrapAnsi16m();
19388
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
19389
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
19390
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
19391
+ Object.defineProperties(styles, {
19382
19392
  rgbToAnsi256: {
19383
- value: (red, green, blue) => {
19393
+ value(red, green, blue) {
19384
19394
  if (red === green && green === blue) {
19385
19395
  if (red < 8) {
19386
19396
  return 16;
@@ -19395,12 +19405,12 @@ function assembleStyles() {
19395
19405
  enumerable: false
19396
19406
  },
19397
19407
  hexToRgb: {
19398
- value: (hex) => {
19399
- const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
19408
+ value(hex) {
19409
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
19400
19410
  if (!matches) {
19401
19411
  return [0, 0, 0];
19402
19412
  }
19403
- let { colorString } = matches.groups;
19413
+ let [colorString] = matches;
19404
19414
  if (colorString.length === 3) {
19405
19415
  colorString = [...colorString].map((character) => character + character).join("");
19406
19416
  }
@@ -19414,11 +19424,11 @@ function assembleStyles() {
19414
19424
  enumerable: false
19415
19425
  },
19416
19426
  hexToAnsi256: {
19417
- value: (hex) => styles2.rgbToAnsi256(...styles2.hexToRgb(hex)),
19427
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
19418
19428
  enumerable: false
19419
19429
  },
19420
19430
  ansi256ToAnsi: {
19421
- value: (code) => {
19431
+ value(code) {
19422
19432
  if (code < 8) {
19423
19433
  return 30 + code;
19424
19434
  }
@@ -19452,20 +19462,20 @@ function assembleStyles() {
19452
19462
  enumerable: false
19453
19463
  },
19454
19464
  rgbToAnsi: {
19455
- value: (red, green, blue) => styles2.ansi256ToAnsi(styles2.rgbToAnsi256(red, green, blue)),
19465
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
19456
19466
  enumerable: false
19457
19467
  },
19458
19468
  hexToAnsi: {
19459
- value: (hex) => styles2.ansi256ToAnsi(styles2.hexToAnsi256(hex)),
19469
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
19460
19470
  enumerable: false
19461
19471
  }
19462
19472
  });
19463
- return styles2;
19473
+ return styles;
19464
19474
  }
19465
19475
  var ansiStyles = assembleStyles();
19466
19476
  var ansi_styles_default = ansiStyles;
19467
19477
 
19468
- // node_modules/.pnpm/chalk@5.0.1/node_modules/chalk/source/vendor/supports-color/index.js
19478
+ // node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/vendor/supports-color/index.js
19469
19479
  var import_node_process = __toESM(require("process"), 1);
19470
19480
  var import_node_os = __toESM(require("os"), 1);
19471
19481
  var import_node_tty = __toESM(require("tty"), 1);
@@ -19583,7 +19593,7 @@ var supportsColor = {
19583
19593
  };
19584
19594
  var supports_color_default = supportsColor;
19585
19595
 
19586
- // node_modules/.pnpm/chalk@5.0.1/node_modules/chalk/source/utilities.js
19596
+ // node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/utilities.js
19587
19597
  function stringReplaceAll(string, substring, replacer) {
19588
19598
  let index3 = string.indexOf(substring);
19589
19599
  if (index3 === -1) {
@@ -19593,7 +19603,7 @@ function stringReplaceAll(string, substring, replacer) {
19593
19603
  let endIndex = 0;
19594
19604
  let returnValue = "";
19595
19605
  do {
19596
- returnValue += string.substr(endIndex, index3 - endIndex) + substring + replacer;
19606
+ returnValue += string.slice(endIndex, index3) + substring + replacer;
19597
19607
  endIndex = index3 + substringLength;
19598
19608
  index3 = string.indexOf(substring, endIndex);
19599
19609
  } while (index3 !== -1);
@@ -19605,7 +19615,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index3) {
19605
19615
  let returnValue = "";
19606
19616
  do {
19607
19617
  const gotCR = string[index3 - 1] === "\r";
19608
- returnValue += string.substr(endIndex, (gotCR ? index3 - 1 : index3) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
19618
+ returnValue += string.slice(endIndex, gotCR ? index3 - 1 : index3) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
19609
19619
  endIndex = index3 + 1;
19610
19620
  index3 = string.indexOf("\n", endIndex);
19611
19621
  } while (index3 !== -1);
@@ -19613,7 +19623,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index3) {
19613
19623
  return returnValue;
19614
19624
  }
19615
19625
 
19616
- // node_modules/.pnpm/chalk@5.0.1/node_modules/chalk/source/index.js
19626
+ // node_modules/.pnpm/chalk@5.1.2/node_modules/chalk/source/index.js
19617
19627
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
19618
19628
  var GENERATOR = Symbol("GENERATOR");
19619
19629
  var STYLER = Symbol("STYLER");
@@ -19624,7 +19634,7 @@ var levelMapping = [
19624
19634
  "ansi256",
19625
19635
  "ansi16m"
19626
19636
  ];
19627
- var styles = /* @__PURE__ */ Object.create(null);
19637
+ var styles2 = /* @__PURE__ */ Object.create(null);
19628
19638
  var applyOptions = (object, options = {}) => {
19629
19639
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
19630
19640
  throw new Error("The `level` option should be an integer from 0 to 3");
@@ -19643,7 +19653,7 @@ function createChalk(options) {
19643
19653
  }
19644
19654
  Object.setPrototypeOf(createChalk.prototype, Function.prototype);
19645
19655
  for (const [styleName, style] of Object.entries(ansi_styles_default)) {
19646
- styles[styleName] = {
19656
+ styles2[styleName] = {
19647
19657
  get() {
19648
19658
  const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
19649
19659
  Object.defineProperty(this, styleName, { value: builder });
@@ -19651,7 +19661,7 @@ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
19651
19661
  }
19652
19662
  };
19653
19663
  }
19654
- styles.visible = {
19664
+ styles2.visible = {
19655
19665
  get() {
19656
19666
  const builder = createBuilder(this, this[STYLER], true);
19657
19667
  Object.defineProperty(this, "visible", { value: builder });
@@ -19675,7 +19685,7 @@ var getModelAnsi = (model, level, type, ...arguments_) => {
19675
19685
  };
19676
19686
  var usedModels = ["rgb", "hex", "ansi256"];
19677
19687
  for (const model of usedModels) {
19678
- styles[model] = {
19688
+ styles2[model] = {
19679
19689
  get() {
19680
19690
  const { level } = this;
19681
19691
  return function(...arguments_) {
@@ -19685,7 +19695,7 @@ for (const model of usedModels) {
19685
19695
  }
19686
19696
  };
19687
19697
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
19688
- styles[bgModel] = {
19698
+ styles2[bgModel] = {
19689
19699
  get() {
19690
19700
  const { level } = this;
19691
19701
  return function(...arguments_) {
@@ -19697,7 +19707,7 @@ for (const model of usedModels) {
19697
19707
  }
19698
19708
  var proto = Object.defineProperties(() => {
19699
19709
  }, {
19700
- ...styles,
19710
+ ...styles2,
19701
19711
  level: {
19702
19712
  enumerable: true,
19703
19713
  get() {
@@ -19755,7 +19765,7 @@ var applyStyle = (self2, string) => {
19755
19765
  }
19756
19766
  return openAll + string + closeAll;
19757
19767
  };
19758
- Object.defineProperties(createChalk.prototype, styles);
19768
+ Object.defineProperties(createChalk.prototype, styles2);
19759
19769
  var chalk = createChalk();
19760
19770
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
19761
19771
  var source_default = chalk;
@@ -19896,7 +19906,7 @@ var validateWithReport = (root, migrationFolders) => {
19896
19906
  var _a;
19897
19907
  const snapshotName = `${folder}/snapshot.json`;
19898
19908
  const raw = JSON.parse(
19899
- import_fs2.default.readFileSync(`./${root}/${folder}/snapshot.json`).toString()
19909
+ import_fs3.default.readFileSync(`./${root}/${folder}/snapshot.json`).toString()
19900
19910
  );
19901
19911
  accum.rawMap[folder] = raw;
19902
19912
  if (raw["version"] && Number(raw["version"]) > 3) {
@@ -19933,11 +19943,11 @@ var validateWithReport = (root, migrationFolders) => {
19933
19943
  };
19934
19944
  var prepareMigration = (outFolder = "drizzle", schemaPath) => {
19935
19945
  const root = outFolder;
19936
- const outFolderExists = import_fs2.default.existsSync(outFolder);
19946
+ const outFolderExists = import_fs3.default.existsSync(outFolder);
19937
19947
  if (!outFolderExists) {
19938
- import_fs2.default.mkdirSync(root);
19948
+ import_fs3.default.mkdirSync(root);
19939
19949
  }
19940
- const migrationFolders = import_fs2.default.readdirSync(root).filter((it) => it.length === 14 && /^\d+$/.test(it));
19950
+ const migrationFolders = import_fs3.default.readdirSync(root).filter((it) => it.length === 14 && /^\d+$/.test(it));
19941
19951
  migrationFolders.sort();
19942
19952
  const report = validateWithReport(root, migrationFolders);
19943
19953
  if (report.nonLatest.length > 0) {
@@ -19976,7 +19986,7 @@ var prepareMigration = (outFolder = "drizzle", schemaPath) => {
19976
19986
  } else {
19977
19987
  const lastSnapshotFolder = migrationFolders[migrationFolders.length - 1];
19978
19988
  prevSnapshot = JSON.parse(
19979
- import_fs2.default.readFileSync(`${root}/${lastSnapshotFolder}/snapshot.json`).toString()
19989
+ import_fs3.default.readFileSync(`${root}/${lastSnapshotFolder}/snapshot.json`).toString()
19980
19990
  );
19981
19991
  }
19982
19992
  const serialized = serializer_default(schemaPath);
@@ -19996,7 +20006,7 @@ var prepareAndMigrate = async (config) => {
19996
20006
  const schemaPath = config.schema;
19997
20007
  try {
19998
20008
  const { prev, cur } = migrationPreparator_default(outFolder, schemaPath);
19999
- const toSave = structuredClone(cur);
20009
+ const toSave = JSON.parse(JSON.stringify(cur));
20000
20010
  const validatedPrev = commonSchema.parse(prev);
20001
20011
  const validatedCur = commonSchema.parse(cur);
20002
20012
  if (validatedPrev.version !== "3" || validatedCur.version !== "3") {
@@ -20012,12 +20022,12 @@ var prepareAndMigrate = async (config) => {
20012
20022
  }
20013
20023
  const folderName = prepareSnapshotFolderName();
20014
20024
  const migrationFolderPath = `./${outFolder}/${folderName}`;
20015
- import_fs3.default.mkdirSync(migrationFolderPath);
20016
- import_fs3.default.writeFileSync(
20025
+ import_fs4.default.mkdirSync(migrationFolderPath);
20026
+ import_fs4.default.writeFileSync(
20017
20027
  `${migrationFolderPath}/snapshot.json`,
20018
20028
  JSON.stringify(toSave, null, 2)
20019
20029
  );
20020
- import_fs3.default.writeFileSync(`${migrationFolderPath}/migration.sql`, sql);
20030
+ import_fs4.default.writeFileSync(`${migrationFolderPath}/migration.sql`, sql);
20021
20031
  console.log(
20022
20032
  source_default.bold.green("Done:"),
20023
20033
  import_path2.default.join(
@@ -20164,17 +20174,17 @@ var two = (input) => {
20164
20174
  };
20165
20175
 
20166
20176
  // src/cli/index.ts
20167
- var import_fs6 = __toESM(require("fs"));
20177
+ var import_fs7 = __toESM(require("fs"));
20168
20178
 
20169
20179
  // src/cli/commands/check.ts
20170
- var import_fs4 = __toESM(require("fs"));
20180
+ var import_fs5 = __toESM(require("fs"));
20171
20181
  var checkHandler = (config) => {
20172
20182
  const { dialect: dialect3, out } = config;
20173
- const outFolderExists = import_fs4.default.existsSync(out);
20183
+ const outFolderExists = import_fs5.default.existsSync(out);
20174
20184
  if (!outFolderExists) {
20175
- import_fs4.default.mkdirSync(out);
20185
+ import_fs5.default.mkdirSync(out);
20176
20186
  }
20177
- const migrationFolders = import_fs4.default.readdirSync(out).filter((it) => it.length === 14 && /^\d+$/.test(it));
20187
+ const migrationFolders = import_fs5.default.readdirSync(out).filter((it) => it.length === 14 && /^\d+$/.test(it));
20178
20188
  migrationFolders.sort();
20179
20189
  const report = validateWithReport(out, migrationFolders);
20180
20190
  if (report.nonLatest.length > 0) {
@@ -20210,15 +20220,15 @@ var checkHandler = (config) => {
20210
20220
 
20211
20221
  // src/cli/commands/up.ts
20212
20222
  var import_crypto2 = require("crypto");
20213
- var import_fs5 = __toESM(require("fs"));
20223
+ var import_fs6 = __toESM(require("fs"));
20214
20224
  var import_path3 = __toESM(require("path"));
20215
20225
  var upHandler = (config) => {
20216
20226
  const { dialect: dialect3, out } = config;
20217
- const outFolderExists = import_fs5.default.existsSync(out);
20227
+ const outFolderExists = import_fs6.default.existsSync(out);
20218
20228
  if (!outFolderExists) {
20219
- import_fs5.default.mkdirSync(out);
20229
+ import_fs6.default.mkdirSync(out);
20220
20230
  }
20221
- const migrationFolders = import_fs5.default.readdirSync(out).filter((it) => it.length === 14 && /^\d+$/.test(it));
20231
+ const migrationFolders = import_fs6.default.readdirSync(out).filter((it) => it.length === 14 && /^\d+$/.test(it));
20222
20232
  migrationFolders.sort();
20223
20233
  const report = validateWithReport(out, migrationFolders);
20224
20234
  let prevId = originUUID;
@@ -20230,7 +20240,7 @@ var upHandler = (config) => {
20230
20240
  const result = updateToLatest(it.raw, prevId);
20231
20241
  prevId = result.id;
20232
20242
  console.log(import_path3.default.join(out, folder, "snapshot.json"), "updated");
20233
- import_fs5.default.writeFileSync(
20243
+ import_fs6.default.writeFileSync(
20234
20244
  import_path3.default.join(out, folder, "snapshot.json"),
20235
20245
  JSON.stringify(result, null, 2)
20236
20246
  );
@@ -20381,7 +20391,7 @@ var prepareGenerateConfig = (options) => {
20381
20391
  if (!(schema4 || out)) {
20382
20392
  const path3 = config != null ? config : "drizzle.config.json";
20383
20393
  const drizzleConfig = JSON.parse(
20384
- import_fs6.default.readFileSync(path3).toString()
20394
+ import_fs7.default.readFileSync(path3).toString()
20385
20395
  );
20386
20396
  return drizzleConfig;
20387
20397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
4
4
  "repository": "https://github.com/lambda-direct/drizzle-kit",
5
5
  "author": "Alex Blokh <aleksandrblokh@gmail.com>",
6
6
  "license": "MIT",
@@ -8,7 +8,6 @@
8
8
  "drizzle-kit": "./index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@ungap/structured-clone": "^1.0.1",
12
11
  "chalk": "^5.0.1",
13
12
  "commander": "^9.4.0",
14
13
  "hanji": "^0.0.3",
@@ -35,6 +34,7 @@
35
34
  },
36
35
  "scripts": {
37
36
  "start:pg": "node -r esbuild-register ./src/cli/index.ts generate --out ./dev/migrations --dialect pg --schema ./dev/data",
37
+ "start:oleksi": "node -r esbuild-register ./src/cli/index.ts generate --out ./dev/oleksi --dialect pg --schema ./dev/data/tables",
38
38
  "check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
39
39
  "up:pg": "node -r esbuild-register ./src/cli/index.ts up --out ./dev/equedi --dialect pg",
40
40
  "check:equedi": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/equedi --dialect pg",