drizzle-kit 0.24.2 → 0.25.0-05b9e35

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 (10) hide show
  1. package/api.d.mts +474 -0
  2. package/api.d.ts +474 -0
  3. package/api.js +96467 -14591
  4. package/api.mjs +96462 -14590
  5. package/bin.cjs +49831 -47589
  6. package/index.d.mts +3 -4
  7. package/index.d.ts +3 -4
  8. package/package.json +3 -2
  9. package/utils.js +62 -11
  10. package/utils.mjs +61 -11
package/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -128,8 +128,7 @@ type Config = {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
130
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
131
+ dialect: Verify<Dialect, 'turso'>;
133
132
  dbCredentials: {
134
133
  url: string;
135
134
  authToken?: string;
package/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -128,8 +128,7 @@ type Config = {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
130
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
131
+ dialect: Verify<Dialect, 'turso'>;
133
132
  dbCredentials: {
134
133
  url: string;
135
134
  authToken?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.2",
3
+ "version": "0.25.0-05b9e35",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -54,7 +54,7 @@
54
54
  "@electric-sql/pglite": "^0.1.5",
55
55
  "@hono/node-server": "^1.9.0",
56
56
  "@hono/zod-validator": "^0.2.1",
57
- "@libsql/client": "^0.4.2",
57
+ "@libsql/client": "^0.10.0",
58
58
  "@neondatabase/serverless": "^0.9.1",
59
59
  "@originjs/vite-plugin-commonjs": "^1.0.3",
60
60
  "@planetscale/database": "^1.16.0",
@@ -74,6 +74,7 @@
74
74
  "@vercel/postgres": "^0.8.0",
75
75
  "ava": "^5.1.0",
76
76
  "better-sqlite3": "^9.4.3",
77
+ "bun-types": "^0.6.6",
77
78
  "camelcase": "^7.0.1",
78
79
  "chalk": "^5.2.0",
79
80
  "commander": "^12.1.0",
package/utils.js CHANGED
@@ -409,8 +409,8 @@ var require_hanji = __commonJS({
409
409
  };
410
410
  exports2.deferred = deferred;
411
411
  var Terminal = class {
412
- constructor(view, stdin, stdout, closable) {
413
- this.view = view;
412
+ constructor(view2, stdin, stdout, closable) {
413
+ this.view = view2;
414
414
  this.stdin = stdin;
415
415
  this.stdout = stdout;
416
416
  this.closable = closable;
@@ -448,7 +448,7 @@ var require_hanji = __commonJS({
448
448
  this.resolve({ status: "submitted", data: this.view.result() });
449
449
  return;
450
450
  }
451
- view.input(str, key);
451
+ view2.input(str, key);
452
452
  };
453
453
  this.stdin.on("keypress", keypress);
454
454
  this.view.attach(this);
@@ -510,8 +510,8 @@ var require_hanji = __commonJS({
510
510
  };
511
511
  exports2.TaskView = TaskView2;
512
512
  var TaskTerminal = class {
513
- constructor(view, stdout) {
514
- this.view = view;
513
+ constructor(view2, stdout) {
514
+ this.view = view2;
515
515
  this.stdout = stdout;
516
516
  this.text = "";
517
517
  this.view.attach(this);
@@ -530,22 +530,22 @@ var require_hanji = __commonJS({
530
530
  }
531
531
  };
532
532
  exports2.TaskTerminal = TaskTerminal;
533
- function render2(view) {
533
+ function render2(view2) {
534
534
  const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
535
- if (view instanceof Prompt2) {
536
- const terminal = new Terminal(view, stdin, stdout, closable);
535
+ if (view2 instanceof Prompt2) {
536
+ const terminal = new Terminal(view2, stdin, stdout, closable);
537
537
  terminal.requestLayout();
538
538
  return terminal.result();
539
539
  }
540
- stdout.write(`${view}
540
+ stdout.write(`${view2}
541
541
  `);
542
542
  closable.close();
543
543
  return;
544
544
  }
545
545
  exports2.render = render2;
546
- function renderWithTask(view, task) {
546
+ function renderWithTask(view2, task) {
547
547
  return __awaiter(this, void 0, void 0, function* () {
548
- const terminal = new TaskTerminal(view, process.stdout);
548
+ const terminal = new TaskTerminal(view2, process.stdout);
549
549
  terminal.requestLayout();
550
550
  const result = yield task;
551
551
  terminal.clear();
@@ -568,6 +568,7 @@ __export(utils_exports, {
568
568
  columnRenameKey: () => columnRenameKey,
569
569
  copy: () => copy,
570
570
  dryJournal: () => dryJournal,
571
+ findAddedAndRemoved: () => findAddedAndRemoved,
571
572
  isPgArrayType: () => isPgArrayType,
572
573
  kloudMeta: () => kloudMeta,
573
574
  normalisePGliteUrl: () => normalisePGliteUrl,
@@ -5209,6 +5210,44 @@ var uniqueConstraint2 = objectType({
5209
5210
  columns: stringType().array(),
5210
5211
  nullsNotDistinct: booleanType()
5211
5212
  }).strict();
5213
+ var viewWithOption = objectType({
5214
+ checkOption: enumType(["local", "cascaded"]).optional(),
5215
+ securityBarrier: booleanType().optional(),
5216
+ securityInvoker: booleanType().optional()
5217
+ }).strict();
5218
+ var matViewWithOption = objectType({
5219
+ fillfactor: numberType().optional(),
5220
+ toastTupleTarget: numberType().optional(),
5221
+ parallelWorkers: numberType().optional(),
5222
+ autovacuumEnabled: booleanType().optional(),
5223
+ vacuumIndexCleanup: enumType(["auto", "off", "on"]).optional(),
5224
+ vacuumTruncate: booleanType().optional(),
5225
+ autovacuumVacuumThreshold: numberType().optional(),
5226
+ autovacuumVacuumScaleFactor: numberType().optional(),
5227
+ autovacuumVacuumCostDelay: numberType().optional(),
5228
+ autovacuumVacuumCostLimit: numberType().optional(),
5229
+ autovacuumFreezeMinAge: numberType().optional(),
5230
+ autovacuumFreezeMaxAge: numberType().optional(),
5231
+ autovacuumFreezeTableAge: numberType().optional(),
5232
+ autovacuumMultixactFreezeMinAge: numberType().optional(),
5233
+ autovacuumMultixactFreezeMaxAge: numberType().optional(),
5234
+ autovacuumMultixactFreezeTableAge: numberType().optional(),
5235
+ logAutovacuumMinDuration: numberType().optional(),
5236
+ userCatalogTable: booleanType().optional()
5237
+ }).strict();
5238
+ var mergedViewWithOption = viewWithOption.merge(matViewWithOption);
5239
+ var view = objectType({
5240
+ name: stringType(),
5241
+ schema: stringType(),
5242
+ columns: recordType(stringType(), column2),
5243
+ definition: stringType().optional(),
5244
+ materialized: booleanType(),
5245
+ with: mergedViewWithOption.optional(),
5246
+ isExisting: booleanType(),
5247
+ withNoData: booleanType().optional(),
5248
+ using: stringType().optional(),
5249
+ tablespace: stringType().optional()
5250
+ }).strict();
5212
5251
  var tableV42 = objectType({
5213
5252
  name: stringType(),
5214
5253
  schema: stringType(),
@@ -5343,6 +5382,7 @@ var pgSchemaInternal = objectType({
5343
5382
  tables: recordType(stringType(), table2),
5344
5383
  enums: recordType(stringType(), enumSchema),
5345
5384
  schemas: recordType(stringType(), stringType()),
5385
+ views: recordType(stringType(), view).default({}),
5346
5386
  sequences: recordType(stringType(), sequenceSchema).default({}),
5347
5387
  _meta: objectType({
5348
5388
  schemas: recordType(stringType(), stringType()),
@@ -5387,6 +5427,7 @@ var pgSchemaSquashed = objectType({
5387
5427
  tables: recordType(stringType(), tableSquashed2),
5388
5428
  enums: recordType(stringType(), enumSchema),
5389
5429
  schemas: recordType(stringType(), stringType()),
5430
+ views: recordType(stringType(), view),
5390
5431
  sequences: recordType(stringType(), sequenceSquashed)
5391
5432
  }).strict();
5392
5433
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
@@ -5596,6 +5637,8 @@ var validatorForDialect = (dialect3) => {
5596
5637
  return { validator: backwardCompatiblePgSchema, version: 7 };
5597
5638
  case "sqlite":
5598
5639
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5640
+ case "turso":
5641
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5599
5642
  case "mysql":
5600
5643
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5601
5644
  }
@@ -5750,12 +5793,20 @@ var normalisePGliteUrl = (it) => {
5750
5793
  function isPgArrayType(sqlType) {
5751
5794
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5752
5795
  }
5796
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5797
+ const set1 = new Set(columnNames1);
5798
+ const set2 = new Set(columnNames2);
5799
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5800
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5801
+ return { addedColumns, removedColumns };
5802
+ }
5753
5803
  // Annotate the CommonJS export names for ESM import in node:
5754
5804
  0 && (module.exports = {
5755
5805
  assertV1OutFolder,
5756
5806
  columnRenameKey,
5757
5807
  copy,
5758
5808
  dryJournal,
5809
+ findAddedAndRemoved,
5759
5810
  isPgArrayType,
5760
5811
  kloudMeta,
5761
5812
  normalisePGliteUrl,
package/utils.mjs CHANGED
@@ -410,8 +410,8 @@ var require_hanji = __commonJS({
410
410
  };
411
411
  exports.deferred = deferred;
412
412
  var Terminal = class {
413
- constructor(view, stdin, stdout, closable) {
414
- this.view = view;
413
+ constructor(view2, stdin, stdout, closable) {
414
+ this.view = view2;
415
415
  this.stdin = stdin;
416
416
  this.stdout = stdout;
417
417
  this.closable = closable;
@@ -449,7 +449,7 @@ var require_hanji = __commonJS({
449
449
  this.resolve({ status: "submitted", data: this.view.result() });
450
450
  return;
451
451
  }
452
- view.input(str, key);
452
+ view2.input(str, key);
453
453
  };
454
454
  this.stdin.on("keypress", keypress);
455
455
  this.view.attach(this);
@@ -511,8 +511,8 @@ var require_hanji = __commonJS({
511
511
  };
512
512
  exports.TaskView = TaskView2;
513
513
  var TaskTerminal = class {
514
- constructor(view, stdout) {
515
- this.view = view;
514
+ constructor(view2, stdout) {
515
+ this.view = view2;
516
516
  this.stdout = stdout;
517
517
  this.text = "";
518
518
  this.view.attach(this);
@@ -531,22 +531,22 @@ var require_hanji = __commonJS({
531
531
  }
532
532
  };
533
533
  exports.TaskTerminal = TaskTerminal;
534
- function render2(view) {
534
+ function render2(view2) {
535
535
  const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
536
- if (view instanceof Prompt2) {
537
- const terminal = new Terminal(view, stdin, stdout, closable);
536
+ if (view2 instanceof Prompt2) {
537
+ const terminal = new Terminal(view2, stdin, stdout, closable);
538
538
  terminal.requestLayout();
539
539
  return terminal.result();
540
540
  }
541
- stdout.write(`${view}
541
+ stdout.write(`${view2}
542
542
  `);
543
543
  closable.close();
544
544
  return;
545
545
  }
546
546
  exports.render = render2;
547
- function renderWithTask(view, task) {
547
+ function renderWithTask(view2, task) {
548
548
  return __awaiter(this, void 0, void 0, function* () {
549
- const terminal = new TaskTerminal(view, process.stdout);
549
+ const terminal = new TaskTerminal(view2, process.stdout);
550
550
  terminal.requestLayout();
551
551
  const result = yield task;
552
552
  terminal.clear();
@@ -5189,6 +5189,44 @@ var uniqueConstraint2 = objectType({
5189
5189
  columns: stringType().array(),
5190
5190
  nullsNotDistinct: booleanType()
5191
5191
  }).strict();
5192
+ var viewWithOption = objectType({
5193
+ checkOption: enumType(["local", "cascaded"]).optional(),
5194
+ securityBarrier: booleanType().optional(),
5195
+ securityInvoker: booleanType().optional()
5196
+ }).strict();
5197
+ var matViewWithOption = objectType({
5198
+ fillfactor: numberType().optional(),
5199
+ toastTupleTarget: numberType().optional(),
5200
+ parallelWorkers: numberType().optional(),
5201
+ autovacuumEnabled: booleanType().optional(),
5202
+ vacuumIndexCleanup: enumType(["auto", "off", "on"]).optional(),
5203
+ vacuumTruncate: booleanType().optional(),
5204
+ autovacuumVacuumThreshold: numberType().optional(),
5205
+ autovacuumVacuumScaleFactor: numberType().optional(),
5206
+ autovacuumVacuumCostDelay: numberType().optional(),
5207
+ autovacuumVacuumCostLimit: numberType().optional(),
5208
+ autovacuumFreezeMinAge: numberType().optional(),
5209
+ autovacuumFreezeMaxAge: numberType().optional(),
5210
+ autovacuumFreezeTableAge: numberType().optional(),
5211
+ autovacuumMultixactFreezeMinAge: numberType().optional(),
5212
+ autovacuumMultixactFreezeMaxAge: numberType().optional(),
5213
+ autovacuumMultixactFreezeTableAge: numberType().optional(),
5214
+ logAutovacuumMinDuration: numberType().optional(),
5215
+ userCatalogTable: booleanType().optional()
5216
+ }).strict();
5217
+ var mergedViewWithOption = viewWithOption.merge(matViewWithOption);
5218
+ var view = objectType({
5219
+ name: stringType(),
5220
+ schema: stringType(),
5221
+ columns: recordType(stringType(), column2),
5222
+ definition: stringType().optional(),
5223
+ materialized: booleanType(),
5224
+ with: mergedViewWithOption.optional(),
5225
+ isExisting: booleanType(),
5226
+ withNoData: booleanType().optional(),
5227
+ using: stringType().optional(),
5228
+ tablespace: stringType().optional()
5229
+ }).strict();
5192
5230
  var tableV42 = objectType({
5193
5231
  name: stringType(),
5194
5232
  schema: stringType(),
@@ -5323,6 +5361,7 @@ var pgSchemaInternal = objectType({
5323
5361
  tables: recordType(stringType(), table2),
5324
5362
  enums: recordType(stringType(), enumSchema),
5325
5363
  schemas: recordType(stringType(), stringType()),
5364
+ views: recordType(stringType(), view).default({}),
5326
5365
  sequences: recordType(stringType(), sequenceSchema).default({}),
5327
5366
  _meta: objectType({
5328
5367
  schemas: recordType(stringType(), stringType()),
@@ -5367,6 +5406,7 @@ var pgSchemaSquashed = objectType({
5367
5406
  tables: recordType(stringType(), tableSquashed2),
5368
5407
  enums: recordType(stringType(), enumSchema),
5369
5408
  schemas: recordType(stringType(), stringType()),
5409
+ views: recordType(stringType(), view),
5370
5410
  sequences: recordType(stringType(), sequenceSquashed)
5371
5411
  }).strict();
5372
5412
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
@@ -5576,6 +5616,8 @@ var validatorForDialect = (dialect3) => {
5576
5616
  return { validator: backwardCompatiblePgSchema, version: 7 };
5577
5617
  case "sqlite":
5578
5618
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5619
+ case "turso":
5620
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5579
5621
  case "mysql":
5580
5622
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5581
5623
  }
@@ -5730,11 +5772,19 @@ var normalisePGliteUrl = (it) => {
5730
5772
  function isPgArrayType(sqlType) {
5731
5773
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5732
5774
  }
5775
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5776
+ const set1 = new Set(columnNames1);
5777
+ const set2 = new Set(columnNames2);
5778
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5779
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5780
+ return { addedColumns, removedColumns };
5781
+ }
5733
5782
  export {
5734
5783
  assertV1OutFolder,
5735
5784
  columnRenameKey,
5736
5785
  copy,
5737
5786
  dryJournal,
5787
+ findAddedAndRemoved,
5738
5788
  isPgArrayType,
5739
5789
  kloudMeta,
5740
5790
  normalisePGliteUrl,