drizzle-kit 0.20.17-7f33638 → 0.20.17-8018c29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/bin.cjs +57946 -11193
  2. package/index.d.mts +38 -64
  3. package/index.d.ts +38 -64
  4. package/package.json +15 -20
  5. package/payload.d.mts +987 -18
  6. package/payload.d.ts +987 -18
  7. package/payload.js +20014 -36130
  8. package/payload.mjs +19927 -36017
  9. package/utils-studio.js +207 -2641
  10. package/utils-studio.mjs +207 -2641
  11. package/utils.js +32 -26
  12. package/utils.mjs +32 -26
  13. package/@types/utils.d.ts +0 -12
  14. package/cli/commands/migrate.d.ts +0 -287
  15. package/cli/commands/mysqlIntrospect.d.ts +0 -55
  16. package/cli/commands/mysqlPushUtils.d.ts +0 -14
  17. package/cli/commands/pgIntrospect.d.ts +0 -59
  18. package/cli/commands/pgPushUtils.d.ts +0 -11
  19. package/cli/commands/sqliteIntrospect.d.ts +0 -104
  20. package/cli/commands/sqlitePushUtils.d.ts +0 -15
  21. package/cli/commands/utils.d.ts +0 -58
  22. package/cli/selector-ui.d.ts +0 -13
  23. package/cli/utils.d.ts +0 -12
  24. package/cli/validations/cli.d.ts +0 -169
  25. package/cli/validations/common.d.ts +0 -214
  26. package/cli/validations/mysql.d.ts +0 -35
  27. package/cli/validations/outputs.d.ts +0 -41
  28. package/cli/validations/pg.d.ts +0 -37
  29. package/cli/validations/sqlite.d.ts +0 -34
  30. package/cli/views.d.ts +0 -63
  31. package/global.d.ts +0 -6
  32. package/introspect-sqlite.d.ts +0 -10
  33. package/jsonDiffer.d.ts +0 -61
  34. package/jsonStatements.d.ts +0 -376
  35. package/migrationPreparator.d.ts +0 -35
  36. package/schemaValidator.d.ts +0 -1316
  37. package/serializer/index.d.ts +0 -9
  38. package/serializer/mysqlImports.d.ts +0 -7
  39. package/serializer/mysqlSchema.d.ts +0 -4964
  40. package/serializer/mysqlSerializer.d.ts +0 -7
  41. package/serializer/pgImports.d.ts +0 -11
  42. package/serializer/pgSchema.d.ts +0 -4792
  43. package/serializer/pgSerializer.d.ts +0 -7
  44. package/serializer/schemaToDrizzle.d.ts +0 -7
  45. package/serializer/sqliteImports.d.ts +0 -7
  46. package/serializer/sqliteSchema.d.ts +0 -2801
  47. package/serializer/sqliteSerializer.d.ts +0 -6
  48. package/snapshotsDiffer.d.ts +0 -3937
  49. package/sqlgenerator.d.ts +0 -33
  50. package/utils/words.d.ts +0 -7
  51. package/utils-studio.d.mts +0 -4
  52. package/utils-studio.d.ts +0 -4
  53. package/utils.d.ts +0 -72
package/utils.js CHANGED
@@ -1079,7 +1079,7 @@ var info = (msg, greyMsg = "") => {
1079
1079
  var originUUID = "00000000-0000-0000-0000-000000000000";
1080
1080
  var snapshotVersion = "6";
1081
1081
 
1082
- // node_modules/.pnpm/zod@3.23.0/node_modules/zod/lib/index.mjs
1082
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
1083
1083
  var util;
1084
1084
  (function(util2) {
1085
1085
  util2.assertEqual = (val) => val;
@@ -4749,10 +4749,13 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
4749
4749
  var ZodReadonly = class extends ZodType {
4750
4750
  _parse(input) {
4751
4751
  const result = this._def.innerType._parse(input);
4752
- if (isValid(result)) {
4753
- result.value = Object.freeze(result.value);
4754
- }
4755
- return result;
4752
+ const freeze = (data) => {
4753
+ if (isValid(data)) {
4754
+ data.value = Object.freeze(data.value);
4755
+ }
4756
+ return data;
4757
+ };
4758
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4756
4759
  }
4757
4760
  unwrap() {
4758
4761
  return this._def.innerType;
@@ -4937,18 +4940,8 @@ var schemaInternalV5 = objectType({
4937
4940
  }),
4938
4941
  internal: kitInternals
4939
4942
  }).strict();
4940
- var schemaInternalV6 = objectType({
4941
- version: literalType("6"),
4942
- dialect,
4943
- tables: recordType(stringType(), table),
4944
- _meta: objectType({
4945
- tables: recordType(stringType(), stringType()),
4946
- columns: recordType(stringType(), stringType())
4947
- }),
4948
- internal: kitInternals
4949
- }).strict();
4950
4943
  var schemaInternal = objectType({
4951
- version: literalType("6"),
4944
+ version: literalType("5"),
4952
4945
  dialect,
4953
4946
  tables: recordType(stringType(), table),
4954
4947
  _meta: objectType({
@@ -4977,7 +4970,7 @@ var tableSquashed = objectType({
4977
4970
  uniqueConstraints: recordType(stringType(), stringType()).default({})
4978
4971
  }).strict();
4979
4972
  var schemaSquashed = objectType({
4980
- version: literalType("6"),
4973
+ version: literalType("5"),
4981
4974
  dialect,
4982
4975
  tables: recordType(stringType(), tableSquashed)
4983
4976
  }).strict();
@@ -4991,7 +4984,7 @@ var mysqlSchema = schema;
4991
4984
  var mysqlSchemaV5 = schemaV5;
4992
4985
  var backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4993
4986
  var dryMySql = mysqlSchema.parse({
4994
- version: snapshotVersion,
4987
+ version: "5",
4995
4988
  dialect: "mysql",
4996
4989
  id: originUUID,
4997
4990
  prevId: "",
@@ -5183,7 +5176,7 @@ var pgSchemaExternal = objectType({
5183
5176
  }).strict();
5184
5177
  var pgSchemaInternal = objectType({
5185
5178
  version: literalType("6"),
5186
- dialect: literalType("pg"),
5179
+ dialect: literalType("postgresql"),
5187
5180
  tables: recordType(stringType(), table2),
5188
5181
  enums: recordType(stringType(), enumSchema),
5189
5182
  schemas: recordType(stringType(), stringType()),
@@ -5212,14 +5205,14 @@ var tableSquashedV42 = objectType({
5212
5205
  }).strict();
5213
5206
  var pgSchemaSquashedV4 = objectType({
5214
5207
  version: literalType("4"),
5215
- dialect: enumType(["pg"]),
5208
+ dialect: literalType("pg"),
5216
5209
  tables: recordType(stringType(), tableSquashedV42),
5217
5210
  enums: recordType(stringType(), enumSchemaV1),
5218
5211
  schemas: recordType(stringType(), stringType())
5219
5212
  }).strict();
5220
5213
  var pgSchemaSquashed = objectType({
5221
5214
  version: literalType("6"),
5222
- dialect: enumType(["pg"]),
5215
+ dialect: literalType("postgresql"),
5223
5216
  tables: recordType(stringType(), tableSquashed2),
5224
5217
  enums: recordType(stringType(), enumSchema),
5225
5218
  schemas: recordType(stringType(), stringType())
@@ -5231,7 +5224,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
5231
5224
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5232
5225
  var dryPg = pgSchema.parse({
5233
5226
  version: snapshotVersion,
5234
- dialect: "pg",
5227
+ dialect: "postgresql",
5235
5228
  id: originUUID,
5236
5229
  prevId: "",
5237
5230
  tables: {},
@@ -5307,7 +5300,17 @@ var schemaInternalV42 = objectType({
5307
5300
  tables: recordType(stringType(), table3),
5308
5301
  enums: objectType({})
5309
5302
  }).strict();
5310
- var latestVersion = literalType("5");
5303
+ var schemaInternalV52 = objectType({
5304
+ version: literalType("5"),
5305
+ dialect: dialect2,
5306
+ tables: recordType(stringType(), table3),
5307
+ enums: objectType({}),
5308
+ _meta: objectType({
5309
+ tables: recordType(stringType(), stringType()),
5310
+ columns: recordType(stringType(), stringType())
5311
+ })
5312
+ }).strict();
5313
+ var latestVersion = literalType("6");
5311
5314
  var schemaInternal2 = objectType({
5312
5315
  version: latestVersion,
5313
5316
  dialect: dialect2,
@@ -5320,6 +5323,7 @@ var schemaInternal2 = objectType({
5320
5323
  }).strict();
5321
5324
  var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
5322
5325
  var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
5326
+ var schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
5323
5327
  var schema2 = schemaInternal2.merge(schemaHash3).strict();
5324
5328
  var tableSquashed3 = objectType({
5325
5329
  name: stringType(),
@@ -5336,7 +5340,7 @@ var schemaSquashed2 = objectType({
5336
5340
  enums: anyType()
5337
5341
  }).strict();
5338
5342
  var drySQLite = schema2.parse({
5339
- version: "5",
5343
+ version: "6",
5340
5344
  dialect: "sqlite",
5341
5345
  id: originUUID,
5342
5346
  prevId: "",
@@ -5347,7 +5351,8 @@ var drySQLite = schema2.parse({
5347
5351
  columns: {}
5348
5352
  }
5349
5353
  });
5350
- var backwardCompatibleSqliteSchema = schema2;
5354
+ var sqliteSchemaV5 = schemaV52;
5355
+ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5351
5356
 
5352
5357
  // src/utils.ts
5353
5358
  var import_path = require("path");
@@ -5393,7 +5398,7 @@ var prepareOutFolder = (out, dialect3) => {
5393
5398
  };
5394
5399
  var validatorForDialect = (dialect3) => {
5395
5400
  switch (dialect3) {
5396
- case "pg":
5401
+ case "postgresql":
5397
5402
  return { validator: backwardCompatiblePgSchema, version: 6 };
5398
5403
  case "sqlite":
5399
5404
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
@@ -5417,6 +5422,7 @@ var validateWithReport = (snapshots, dialect3) => {
5417
5422
  }
5418
5423
  const result2 = validator.safeParse(raw);
5419
5424
  if (!result2.success) {
5425
+ console.error(result2.error);
5420
5426
  accum.malformed.push(it);
5421
5427
  return accum;
5422
5428
  }
package/utils.mjs CHANGED
@@ -1070,7 +1070,7 @@ var info = (msg, greyMsg = "") => {
1070
1070
  var originUUID = "00000000-0000-0000-0000-000000000000";
1071
1071
  var snapshotVersion = "6";
1072
1072
 
1073
- // node_modules/.pnpm/zod@3.23.0/node_modules/zod/lib/index.mjs
1073
+ // node_modules/.pnpm/zod@3.23.6/node_modules/zod/lib/index.mjs
1074
1074
  var util;
1075
1075
  (function(util2) {
1076
1076
  util2.assertEqual = (val) => val;
@@ -4740,10 +4740,13 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
4740
4740
  var ZodReadonly = class extends ZodType {
4741
4741
  _parse(input) {
4742
4742
  const result = this._def.innerType._parse(input);
4743
- if (isValid(result)) {
4744
- result.value = Object.freeze(result.value);
4745
- }
4746
- return result;
4743
+ const freeze = (data) => {
4744
+ if (isValid(data)) {
4745
+ data.value = Object.freeze(data.value);
4746
+ }
4747
+ return data;
4748
+ };
4749
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4747
4750
  }
4748
4751
  unwrap() {
4749
4752
  return this._def.innerType;
@@ -4928,18 +4931,8 @@ var schemaInternalV5 = objectType({
4928
4931
  }),
4929
4932
  internal: kitInternals
4930
4933
  }).strict();
4931
- var schemaInternalV6 = objectType({
4932
- version: literalType("6"),
4933
- dialect,
4934
- tables: recordType(stringType(), table),
4935
- _meta: objectType({
4936
- tables: recordType(stringType(), stringType()),
4937
- columns: recordType(stringType(), stringType())
4938
- }),
4939
- internal: kitInternals
4940
- }).strict();
4941
4934
  var schemaInternal = objectType({
4942
- version: literalType("6"),
4935
+ version: literalType("5"),
4943
4936
  dialect,
4944
4937
  tables: recordType(stringType(), table),
4945
4938
  _meta: objectType({
@@ -4968,7 +4961,7 @@ var tableSquashed = objectType({
4968
4961
  uniqueConstraints: recordType(stringType(), stringType()).default({})
4969
4962
  }).strict();
4970
4963
  var schemaSquashed = objectType({
4971
- version: literalType("6"),
4964
+ version: literalType("5"),
4972
4965
  dialect,
4973
4966
  tables: recordType(stringType(), tableSquashed)
4974
4967
  }).strict();
@@ -4982,7 +4975,7 @@ var mysqlSchema = schema;
4982
4975
  var mysqlSchemaV5 = schemaV5;
4983
4976
  var backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4984
4977
  var dryMySql = mysqlSchema.parse({
4985
- version: snapshotVersion,
4978
+ version: "5",
4986
4979
  dialect: "mysql",
4987
4980
  id: originUUID,
4988
4981
  prevId: "",
@@ -5174,7 +5167,7 @@ var pgSchemaExternal = objectType({
5174
5167
  }).strict();
5175
5168
  var pgSchemaInternal = objectType({
5176
5169
  version: literalType("6"),
5177
- dialect: literalType("pg"),
5170
+ dialect: literalType("postgresql"),
5178
5171
  tables: recordType(stringType(), table2),
5179
5172
  enums: recordType(stringType(), enumSchema),
5180
5173
  schemas: recordType(stringType(), stringType()),
@@ -5203,14 +5196,14 @@ var tableSquashedV42 = objectType({
5203
5196
  }).strict();
5204
5197
  var pgSchemaSquashedV4 = objectType({
5205
5198
  version: literalType("4"),
5206
- dialect: enumType(["pg"]),
5199
+ dialect: literalType("pg"),
5207
5200
  tables: recordType(stringType(), tableSquashedV42),
5208
5201
  enums: recordType(stringType(), enumSchemaV1),
5209
5202
  schemas: recordType(stringType(), stringType())
5210
5203
  }).strict();
5211
5204
  var pgSchemaSquashed = objectType({
5212
5205
  version: literalType("6"),
5213
- dialect: enumType(["pg"]),
5206
+ dialect: literalType("postgresql"),
5214
5207
  tables: recordType(stringType(), tableSquashed2),
5215
5208
  enums: recordType(stringType(), enumSchema),
5216
5209
  schemas: recordType(stringType(), stringType())
@@ -5222,7 +5215,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
5222
5215
  var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5223
5216
  var dryPg = pgSchema.parse({
5224
5217
  version: snapshotVersion,
5225
- dialect: "pg",
5218
+ dialect: "postgresql",
5226
5219
  id: originUUID,
5227
5220
  prevId: "",
5228
5221
  tables: {},
@@ -5298,7 +5291,17 @@ var schemaInternalV42 = objectType({
5298
5291
  tables: recordType(stringType(), table3),
5299
5292
  enums: objectType({})
5300
5293
  }).strict();
5301
- var latestVersion = literalType("5");
5294
+ var schemaInternalV52 = objectType({
5295
+ version: literalType("5"),
5296
+ dialect: dialect2,
5297
+ tables: recordType(stringType(), table3),
5298
+ enums: objectType({}),
5299
+ _meta: objectType({
5300
+ tables: recordType(stringType(), stringType()),
5301
+ columns: recordType(stringType(), stringType())
5302
+ })
5303
+ }).strict();
5304
+ var latestVersion = literalType("6");
5302
5305
  var schemaInternal2 = objectType({
5303
5306
  version: latestVersion,
5304
5307
  dialect: dialect2,
@@ -5311,6 +5314,7 @@ var schemaInternal2 = objectType({
5311
5314
  }).strict();
5312
5315
  var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
5313
5316
  var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
5317
+ var schemaV52 = schemaInternalV52.merge(schemaHash3).strict();
5314
5318
  var schema2 = schemaInternal2.merge(schemaHash3).strict();
5315
5319
  var tableSquashed3 = objectType({
5316
5320
  name: stringType(),
@@ -5327,7 +5331,7 @@ var schemaSquashed2 = objectType({
5327
5331
  enums: anyType()
5328
5332
  }).strict();
5329
5333
  var drySQLite = schema2.parse({
5330
- version: "5",
5334
+ version: "6",
5331
5335
  dialect: "sqlite",
5332
5336
  id: originUUID,
5333
5337
  prevId: "",
@@ -5338,7 +5342,8 @@ var drySQLite = schema2.parse({
5338
5342
  columns: {}
5339
5343
  }
5340
5344
  });
5341
- var backwardCompatibleSqliteSchema = schema2;
5345
+ var sqliteSchemaV5 = schemaV52;
5346
+ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5342
5347
 
5343
5348
  // src/utils.ts
5344
5349
  import { join } from "path";
@@ -5384,7 +5389,7 @@ var prepareOutFolder = (out, dialect3) => {
5384
5389
  };
5385
5390
  var validatorForDialect = (dialect3) => {
5386
5391
  switch (dialect3) {
5387
- case "pg":
5392
+ case "postgresql":
5388
5393
  return { validator: backwardCompatiblePgSchema, version: 6 };
5389
5394
  case "sqlite":
5390
5395
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
@@ -5408,6 +5413,7 @@ var validateWithReport = (snapshots, dialect3) => {
5408
5413
  }
5409
5414
  const result2 = validator.safeParse(raw);
5410
5415
  if (!result2.success) {
5416
+ console.error(result2.error);
5411
5417
  accum.malformed.push(it);
5412
5418
  return accum;
5413
5419
  }
package/@types/utils.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare global {
2
- interface String {
3
- trimChar(char: string): string;
4
- squashSpaces(): string;
5
- camelCase(): string;
6
- concatIf(it: string, condition: boolean): string;
7
- }
8
- interface Array<T> {
9
- random(): T;
10
- }
11
- }
12
- export {};
@@ -1,287 +0,0 @@
1
- import { Column, ColumnsResolverInput, ColumnsResolverOutput, Enum, ResolverInput, ResolverOutput, ResolverOutputWithMoved, Table } from "../../snapshotsDiffer";
2
- import type { CommonSchema } from "../../schemaValidator";
3
- import { PgSchema } from "../../serializer/pgSchema";
4
- import { SQLiteSchema } from "../../serializer/sqliteSchema";
5
- import { MySqlSchema } from "../../serializer/mysqlSchema";
6
- import { Journal } from "../../utils";
7
- import { GenerateConfig } from "./utils";
8
- export type Named = {
9
- name: string;
10
- };
11
- export type NamedWithSchema = {
12
- name: string;
13
- schema: string;
14
- };
15
- export declare const schemasResolver: (input: ResolverInput<Table>) => Promise<ResolverOutput<Table>>;
16
- export declare const tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>;
17
- export declare const enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>;
18
- export declare const columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>;
19
- export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
20
- export declare const preparePgPush: (schemaPath: string | string[], snapshot: PgSchema, schemaFilter: string[]) => Promise<{
21
- sqlStatements: string[];
22
- statements: import("../../jsonStatements").JsonStatement[];
23
- squashedPrev: {
24
- tables: Record<string, {
25
- name: string;
26
- columns: Record<string, {
27
- name: string;
28
- type: string;
29
- primaryKey: boolean;
30
- notNull: boolean;
31
- isUnique?: any;
32
- default?: any;
33
- typeSchema?: string | undefined;
34
- uniqueName?: string | undefined;
35
- nullsNotDistinct?: boolean | undefined;
36
- }>;
37
- indexes: Record<string, string>;
38
- foreignKeys: Record<string, string>;
39
- schema: string;
40
- compositePrimaryKeys: Record<string, string>;
41
- uniqueConstraints: Record<string, string>;
42
- }>;
43
- version: "6";
44
- dialect: "pg";
45
- schemas: Record<string, string>;
46
- enums: Record<string, {
47
- name: string;
48
- values: string[];
49
- schema: string;
50
- }>;
51
- };
52
- squashedCur: {
53
- tables: Record<string, {
54
- name: string;
55
- columns: Record<string, {
56
- name: string;
57
- type: string;
58
- primaryKey: boolean;
59
- notNull: boolean;
60
- isUnique?: any;
61
- default?: any;
62
- typeSchema?: string | undefined;
63
- uniqueName?: string | undefined;
64
- nullsNotDistinct?: boolean | undefined;
65
- }>;
66
- indexes: Record<string, string>;
67
- foreignKeys: Record<string, string>;
68
- schema: string;
69
- compositePrimaryKeys: Record<string, string>;
70
- uniqueConstraints: Record<string, string>;
71
- }>;
72
- version: "6";
73
- dialect: "pg";
74
- schemas: Record<string, string>;
75
- enums: Record<string, {
76
- name: string;
77
- values: string[];
78
- schema: string;
79
- }>;
80
- };
81
- }>;
82
- export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot: MySqlSchema) => Promise<{
83
- sqlStatements: string[];
84
- statements: import("../../jsonStatements").JsonStatement[];
85
- validatedCur: {
86
- tables: Record<string, {
87
- name: string;
88
- columns: Record<string, {
89
- name: string;
90
- type: string;
91
- primaryKey: boolean;
92
- notNull: boolean;
93
- default?: any;
94
- onUpdate?: any;
95
- autoincrement?: boolean | undefined;
96
- }>;
97
- indexes: Record<string, {
98
- name: string;
99
- columns: string[];
100
- isUnique: boolean;
101
- using?: "btree" | "hash" | undefined;
102
- algorithm?: "default" | "inplace" | "copy" | undefined;
103
- lock?: "default" | "none" | "shared" | "exclusive" | undefined;
104
- }>;
105
- foreignKeys: Record<string, {
106
- name: string;
107
- tableFrom: string;
108
- columnsFrom: string[];
109
- tableTo: string;
110
- columnsTo: string[];
111
- onUpdate?: string | undefined;
112
- onDelete?: string | undefined;
113
- }>;
114
- compositePrimaryKeys: Record<string, {
115
- name: string;
116
- columns: string[];
117
- }>;
118
- uniqueConstraints: Record<string, {
119
- name: string;
120
- columns: string[];
121
- }>;
122
- }>;
123
- id: string;
124
- prevId: string;
125
- version: "6";
126
- dialect: "mysql";
127
- _meta: {
128
- columns: Record<string, string>;
129
- tables: Record<string, string>;
130
- };
131
- internal?: {
132
- tables: Record<string, {
133
- columns: Record<string, {
134
- isDefaultAnExpression?: boolean | undefined;
135
- } | undefined>;
136
- } | undefined>;
137
- } | undefined;
138
- };
139
- validatedPrev: {
140
- tables: Record<string, {
141
- name: string;
142
- columns: Record<string, {
143
- name: string;
144
- type: string;
145
- primaryKey: boolean;
146
- notNull: boolean;
147
- default?: any;
148
- onUpdate?: any;
149
- autoincrement?: boolean | undefined;
150
- }>;
151
- indexes: Record<string, {
152
- name: string;
153
- columns: string[];
154
- isUnique: boolean;
155
- using?: "btree" | "hash" | undefined;
156
- algorithm?: "default" | "inplace" | "copy" | undefined;
157
- lock?: "default" | "none" | "shared" | "exclusive" | undefined;
158
- }>;
159
- foreignKeys: Record<string, {
160
- name: string;
161
- tableFrom: string;
162
- columnsFrom: string[];
163
- tableTo: string;
164
- columnsTo: string[];
165
- onUpdate?: string | undefined;
166
- onDelete?: string | undefined;
167
- }>;
168
- compositePrimaryKeys: Record<string, {
169
- name: string;
170
- columns: string[];
171
- }>;
172
- uniqueConstraints: Record<string, {
173
- name: string;
174
- columns: string[];
175
- }>;
176
- }>;
177
- id: string;
178
- prevId: string;
179
- version: "6";
180
- dialect: "mysql";
181
- _meta: {
182
- columns: Record<string, string>;
183
- tables: Record<string, string>;
184
- };
185
- internal?: {
186
- tables: Record<string, {
187
- columns: Record<string, {
188
- isDefaultAnExpression?: boolean | undefined;
189
- } | undefined>;
190
- } | undefined>;
191
- } | undefined;
192
- };
193
- }>;
194
- export declare const prepareAndMigrateMysql: (config: GenerateConfig) => Promise<void>;
195
- export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
196
- export declare const prepareSQLitePush: (schemaPath: string | string[], snapshot: SQLiteSchema) => Promise<{
197
- sqlStatements: string[];
198
- statements: import("../../jsonStatements").JsonStatement[];
199
- squashedPrev: {
200
- tables: Record<string, {
201
- name: string;
202
- columns: Record<string, {
203
- name: string;
204
- type: string;
205
- primaryKey: boolean;
206
- notNull: boolean;
207
- default?: any;
208
- autoincrement?: boolean | undefined;
209
- }>;
210
- indexes: Record<string, string>;
211
- foreignKeys: Record<string, string>;
212
- compositePrimaryKeys: Record<string, string>;
213
- uniqueConstraints: Record<string, string>;
214
- }>;
215
- version: "5";
216
- dialect: "sqlite";
217
- enums?: any;
218
- };
219
- squashedCur: {
220
- tables: Record<string, {
221
- name: string;
222
- columns: Record<string, {
223
- name: string;
224
- type: string;
225
- primaryKey: boolean;
226
- notNull: boolean;
227
- default?: any;
228
- autoincrement?: boolean | undefined;
229
- }>;
230
- indexes: Record<string, string>;
231
- foreignKeys: Record<string, string>;
232
- compositePrimaryKeys: Record<string, string>;
233
- uniqueConstraints: Record<string, string>;
234
- }>;
235
- version: "5";
236
- dialect: "sqlite";
237
- enums?: any;
238
- };
239
- meta: {
240
- schemas: {};
241
- tables: {};
242
- columns: {};
243
- } | undefined;
244
- }>;
245
- export declare const promptColumnsConflicts: <T extends Named>(tableName: string, newColumns: T[], missingColumns: T[]) => Promise<{
246
- created: T[];
247
- renamed: {
248
- from: T;
249
- to: T;
250
- }[];
251
- deleted: T[];
252
- }>;
253
- export declare const promptNamedWithSchemasConflict: <T extends NamedWithSchema>(newItems: T[], missingItems: T[], entity: "table" | "enum") => Promise<{
254
- created: T[];
255
- renamed: {
256
- from: T;
257
- to: T;
258
- }[];
259
- moved: {
260
- name: string;
261
- schemaFrom: string;
262
- schemaTo: string;
263
- }[];
264
- deleted: T[];
265
- }>;
266
- export declare const promptSchemasConflict: <T extends Named>(newSchemas: T[], missingSchemas: T[]) => Promise<{
267
- created: T[];
268
- renamed: {
269
- from: T;
270
- to: T;
271
- }[];
272
- deleted: T[];
273
- }>;
274
- export declare const BREAKPOINT = "--> statement-breakpoint\n";
275
- export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, name, bundle, type, }: {
276
- cur: CommonSchema;
277
- sqlStatements: string[];
278
- journal: Journal;
279
- _meta?: any;
280
- outFolder: string;
281
- breakpoints: boolean;
282
- name?: string;
283
- bundle?: boolean;
284
- type?: "introspect" | "custom" | "none";
285
- }) => void;
286
- export declare const embeddedMigrations: (journal: Journal) => string;
287
- export declare const prepareSnapshotFolderName: () => string;
@@ -1,55 +0,0 @@
1
- import type { MysqlCredentials } from "../validations/mysql";
2
- import type { DB } from "../../utils";
3
- export declare const connectToMySQL: (credentials: MysqlCredentials) => Promise<{
4
- db: DB;
5
- database: string;
6
- }>;
7
- export declare const mysqlPushIntrospect: (db: DB, databaseName: string, filters: string[]) => Promise<{
8
- schema: {
9
- tables: Record<string, {
10
- name: string;
11
- columns: Record<string, {
12
- name: string;
13
- type: string;
14
- primaryKey: boolean;
15
- notNull: boolean;
16
- default?: any;
17
- onUpdate?: any;
18
- autoincrement?: boolean | undefined;
19
- }>;
20
- indexes: Record<string, {
21
- name: string;
22
- columns: string[];
23
- isUnique: boolean;
24
- using?: "btree" | "hash" | undefined;
25
- algorithm?: "default" | "inplace" | "copy" | undefined;
26
- lock?: "default" | "none" | "shared" | "exclusive" | undefined;
27
- }>;
28
- foreignKeys: Record<string, {
29
- name: string;
30
- tableFrom: string;
31
- columnsFrom: string[];
32
- tableTo: string;
33
- columnsTo: string[];
34
- onUpdate?: string | undefined;
35
- onDelete?: string | undefined;
36
- }>;
37
- compositePrimaryKeys: Record<string, {
38
- name: string;
39
- columns: string[];
40
- }>;
41
- uniqueConstraints: Record<string, {
42
- name: string;
43
- columns: string[];
44
- }>;
45
- }>;
46
- id: string;
47
- prevId: string;
48
- version: "6";
49
- dialect: "mysql";
50
- _meta: {
51
- columns: Record<string, string>;
52
- tables: Record<string, string>;
53
- };
54
- };
55
- }>;
@@ -1,14 +0,0 @@
1
- import { JsonStatement } from "../../jsonStatements";
2
- import { mysqlSchema } from "../../serializer/mysqlSchema";
3
- import { TypeOf } from "zod";
4
- import type { DB } from "../../utils";
5
- export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
6
- export declare const logSuggestionsAndReturn: (db: DB, statements: JsonStatement[], json2: TypeOf<typeof mysqlSchema>) => Promise<{
7
- statementsToExecute: string[];
8
- shouldAskForApprove: boolean;
9
- infoToPrint: string[];
10
- columnsToRemove: string[];
11
- schemasToRemove: string[];
12
- tablesToTruncate: string[];
13
- tablesToRemove: string[];
14
- }>;