drizzle-kit 0.24.2 → 0.25.0-06c725b

Sign up to get free protection for your applications and to get access to all the features.
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-06c725b",
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
@@ -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,
@@ -4900,6 +4901,10 @@ var uniqueConstraint = objectType({
4900
4901
  name: stringType(),
4901
4902
  columns: stringType().array()
4902
4903
  }).strict();
4904
+ var checkConstraint = objectType({
4905
+ name: stringType(),
4906
+ value: stringType()
4907
+ }).strict();
4903
4908
  var tableV4 = objectType({
4904
4909
  name: stringType(),
4905
4910
  schema: stringType().optional(),
@@ -4913,7 +4918,8 @@ var table = objectType({
4913
4918
  indexes: recordType(stringType(), index),
4914
4919
  foreignKeys: recordType(stringType(), fk),
4915
4920
  compositePrimaryKeys: recordType(stringType(), compositePK),
4916
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4921
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4922
+ checkConstraint: recordType(stringType(), checkConstraint).default({})
4917
4923
  }).strict();
4918
4924
  var kitInternals = objectType({
4919
4925
  tables: recordType(
@@ -4990,7 +4996,8 @@ var tableSquashed = objectType({
4990
4996
  indexes: recordType(stringType(), stringType()),
4991
4997
  foreignKeys: recordType(stringType(), stringType()),
4992
4998
  compositePrimaryKeys: recordType(stringType(), stringType()),
4993
- uniqueConstraints: recordType(stringType(), stringType()).default({})
4999
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5000
+ checkConstraints: recordType(stringType(), stringType()).default({})
4994
5001
  }).strict();
4995
5002
  var schemaSquashed = objectType({
4996
5003
  version: literalType("5"),
@@ -5178,6 +5185,10 @@ var column2 = objectType({
5178
5185
  }).optional(),
5179
5186
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5180
5187
  }).strict();
5188
+ var checkConstraint2 = objectType({
5189
+ name: stringType(),
5190
+ value: stringType()
5191
+ }).strict();
5181
5192
  var columnSquashed = objectType({
5182
5193
  name: stringType(),
5183
5194
  type: stringType(),
@@ -5250,7 +5261,8 @@ var table2 = objectType({
5250
5261
  indexes: recordType(stringType(), index2),
5251
5262
  foreignKeys: recordType(stringType(), fk2),
5252
5263
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5253
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5264
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5265
+ checkConstraints: recordType(stringType(), checkConstraint2).default({})
5254
5266
  }).strict();
5255
5267
  var schemaHash2 = objectType({
5256
5268
  id: stringType(),
@@ -5358,7 +5370,8 @@ var tableSquashed2 = objectType({
5358
5370
  indexes: recordType(stringType(), stringType()),
5359
5371
  foreignKeys: recordType(stringType(), stringType()),
5360
5372
  compositePrimaryKeys: recordType(stringType(), stringType()),
5361
- uniqueConstraints: recordType(stringType(), stringType())
5373
+ uniqueConstraints: recordType(stringType(), stringType()),
5374
+ checkConstraints: recordType(stringType(), stringType())
5362
5375
  }).strict();
5363
5376
  var tableSquashedV42 = objectType({
5364
5377
  name: stringType(),
@@ -5458,13 +5471,18 @@ var uniqueConstraint3 = objectType({
5458
5471
  name: stringType(),
5459
5472
  columns: stringType().array()
5460
5473
  }).strict();
5474
+ var checkConstraint3 = objectType({
5475
+ name: stringType(),
5476
+ value: stringType()
5477
+ }).strict();
5461
5478
  var table3 = objectType({
5462
5479
  name: stringType(),
5463
5480
  columns: recordType(stringType(), column3),
5464
5481
  indexes: recordType(stringType(), index3),
5465
5482
  foreignKeys: recordType(stringType(), fk3),
5466
5483
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5467
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5484
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5485
+ checkConstraints: recordType(stringType(), checkConstraint3).default({})
5468
5486
  }).strict();
5469
5487
  var dialect2 = enumType(["sqlite"]);
5470
5488
  var schemaHash3 = objectType({
@@ -5526,7 +5544,8 @@ var tableSquashed3 = objectType({
5526
5544
  indexes: recordType(stringType(), stringType()),
5527
5545
  foreignKeys: recordType(stringType(), stringType()),
5528
5546
  compositePrimaryKeys: recordType(stringType(), stringType()),
5529
- uniqueConstraints: recordType(stringType(), stringType()).default({})
5547
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5548
+ checkConstraints: recordType(stringType(), stringType()).default({})
5530
5549
  }).strict();
5531
5550
  var schemaSquashed2 = objectType({
5532
5551
  version: latestVersion,
@@ -5596,6 +5615,8 @@ var validatorForDialect = (dialect3) => {
5596
5615
  return { validator: backwardCompatiblePgSchema, version: 7 };
5597
5616
  case "sqlite":
5598
5617
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5618
+ case "turso":
5619
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5599
5620
  case "mysql":
5600
5621
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5601
5622
  }
@@ -5750,12 +5771,20 @@ var normalisePGliteUrl = (it) => {
5750
5771
  function isPgArrayType(sqlType) {
5751
5772
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5752
5773
  }
5774
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5775
+ const set1 = new Set(columnNames1);
5776
+ const set2 = new Set(columnNames2);
5777
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5778
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5779
+ return { addedColumns, removedColumns };
5780
+ }
5753
5781
  // Annotate the CommonJS export names for ESM import in node:
5754
5782
  0 && (module.exports = {
5755
5783
  assertV1OutFolder,
5756
5784
  columnRenameKey,
5757
5785
  copy,
5758
5786
  dryJournal,
5787
+ findAddedAndRemoved,
5759
5788
  isPgArrayType,
5760
5789
  kloudMeta,
5761
5790
  normalisePGliteUrl,
package/utils.mjs CHANGED
@@ -4880,6 +4880,10 @@ var uniqueConstraint = objectType({
4880
4880
  name: stringType(),
4881
4881
  columns: stringType().array()
4882
4882
  }).strict();
4883
+ var checkConstraint = objectType({
4884
+ name: stringType(),
4885
+ value: stringType()
4886
+ }).strict();
4883
4887
  var tableV4 = objectType({
4884
4888
  name: stringType(),
4885
4889
  schema: stringType().optional(),
@@ -4893,7 +4897,8 @@ var table = objectType({
4893
4897
  indexes: recordType(stringType(), index),
4894
4898
  foreignKeys: recordType(stringType(), fk),
4895
4899
  compositePrimaryKeys: recordType(stringType(), compositePK),
4896
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4900
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4901
+ checkConstraint: recordType(stringType(), checkConstraint).default({})
4897
4902
  }).strict();
4898
4903
  var kitInternals = objectType({
4899
4904
  tables: recordType(
@@ -4970,7 +4975,8 @@ var tableSquashed = objectType({
4970
4975
  indexes: recordType(stringType(), stringType()),
4971
4976
  foreignKeys: recordType(stringType(), stringType()),
4972
4977
  compositePrimaryKeys: recordType(stringType(), stringType()),
4973
- uniqueConstraints: recordType(stringType(), stringType()).default({})
4978
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
4979
+ checkConstraints: recordType(stringType(), stringType()).default({})
4974
4980
  }).strict();
4975
4981
  var schemaSquashed = objectType({
4976
4982
  version: literalType("5"),
@@ -5158,6 +5164,10 @@ var column2 = objectType({
5158
5164
  }).optional(),
5159
5165
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5160
5166
  }).strict();
5167
+ var checkConstraint2 = objectType({
5168
+ name: stringType(),
5169
+ value: stringType()
5170
+ }).strict();
5161
5171
  var columnSquashed = objectType({
5162
5172
  name: stringType(),
5163
5173
  type: stringType(),
@@ -5230,7 +5240,8 @@ var table2 = objectType({
5230
5240
  indexes: recordType(stringType(), index2),
5231
5241
  foreignKeys: recordType(stringType(), fk2),
5232
5242
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5233
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5243
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5244
+ checkConstraints: recordType(stringType(), checkConstraint2).default({})
5234
5245
  }).strict();
5235
5246
  var schemaHash2 = objectType({
5236
5247
  id: stringType(),
@@ -5338,7 +5349,8 @@ var tableSquashed2 = objectType({
5338
5349
  indexes: recordType(stringType(), stringType()),
5339
5350
  foreignKeys: recordType(stringType(), stringType()),
5340
5351
  compositePrimaryKeys: recordType(stringType(), stringType()),
5341
- uniqueConstraints: recordType(stringType(), stringType())
5352
+ uniqueConstraints: recordType(stringType(), stringType()),
5353
+ checkConstraints: recordType(stringType(), stringType())
5342
5354
  }).strict();
5343
5355
  var tableSquashedV42 = objectType({
5344
5356
  name: stringType(),
@@ -5438,13 +5450,18 @@ var uniqueConstraint3 = objectType({
5438
5450
  name: stringType(),
5439
5451
  columns: stringType().array()
5440
5452
  }).strict();
5453
+ var checkConstraint3 = objectType({
5454
+ name: stringType(),
5455
+ value: stringType()
5456
+ }).strict();
5441
5457
  var table3 = objectType({
5442
5458
  name: stringType(),
5443
5459
  columns: recordType(stringType(), column3),
5444
5460
  indexes: recordType(stringType(), index3),
5445
5461
  foreignKeys: recordType(stringType(), fk3),
5446
5462
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5447
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5463
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5464
+ checkConstraints: recordType(stringType(), checkConstraint3).default({})
5448
5465
  }).strict();
5449
5466
  var dialect2 = enumType(["sqlite"]);
5450
5467
  var schemaHash3 = objectType({
@@ -5506,7 +5523,8 @@ var tableSquashed3 = objectType({
5506
5523
  indexes: recordType(stringType(), stringType()),
5507
5524
  foreignKeys: recordType(stringType(), stringType()),
5508
5525
  compositePrimaryKeys: recordType(stringType(), stringType()),
5509
- uniqueConstraints: recordType(stringType(), stringType()).default({})
5526
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5527
+ checkConstraints: recordType(stringType(), stringType()).default({})
5510
5528
  }).strict();
5511
5529
  var schemaSquashed2 = objectType({
5512
5530
  version: latestVersion,
@@ -5576,6 +5594,8 @@ var validatorForDialect = (dialect3) => {
5576
5594
  return { validator: backwardCompatiblePgSchema, version: 7 };
5577
5595
  case "sqlite":
5578
5596
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5597
+ case "turso":
5598
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5579
5599
  case "mysql":
5580
5600
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5581
5601
  }
@@ -5730,11 +5750,19 @@ var normalisePGliteUrl = (it) => {
5730
5750
  function isPgArrayType(sqlType) {
5731
5751
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5732
5752
  }
5753
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5754
+ const set1 = new Set(columnNames1);
5755
+ const set2 = new Set(columnNames2);
5756
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5757
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5758
+ return { addedColumns, removedColumns };
5759
+ }
5733
5760
  export {
5734
5761
  assertV1OutFolder,
5735
5762
  columnRenameKey,
5736
5763
  copy,
5737
5764
  dryJournal,
5765
+ findAddedAndRemoved,
5738
5766
  isPgArrayType,
5739
5767
  kloudMeta,
5740
5768
  normalisePGliteUrl,