drizzle-kit 0.25.0-1fba875 → 0.25.0-20acc2f

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
2
+ type Prefix = (typeof prefixes)[number];
3
+ declare const casingTypes: readonly ["snake_case", "camelCase"];
4
+ type CasingType = (typeof casingTypes)[number];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
+ type Driver = (typeof drivers)[number];
7
+
8
+ export type { CasingType as C, Driver as D, Prefix as P };
@@ -0,0 +1,8 @@
1
+ declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
2
+ type Prefix = (typeof prefixes)[number];
3
+ declare const casingTypes: readonly ["snake_case", "camelCase"];
4
+ type CasingType = (typeof casingTypes)[number];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
+ type Driver = (typeof drivers)[number];
7
+
8
+ export type { CasingType as C, Driver as D, Prefix as P };
package/index.d.mts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { ConnectionOptions } from 'tls';
2
-
3
- declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
- type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
- type Driver = (typeof drivers)[number];
2
+ import { P as Prefix, D as Driver } from './common-DYjgLS6u.mjs';
7
3
 
8
4
  declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
5
  type Dialect = (typeof dialects)[number];
@@ -119,6 +115,7 @@ type Config = {
119
115
  schema?: string | string[];
120
116
  verbose?: boolean;
121
117
  strict?: boolean;
118
+ casing?: 'camelCase' | 'snake_case';
122
119
  migrations?: {
123
120
  table?: string;
124
121
  schema?: string;
package/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { ConnectionOptions } from 'tls';
2
-
3
- declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
- type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
- type Driver = (typeof drivers)[number];
2
+ import { P as Prefix, D as Driver } from './common-DYjgLS6u.js';
7
3
 
8
4
  declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
5
  type Dialect = (typeof dialects)[number];
@@ -119,6 +115,7 @@ type Config = {
119
115
  schema?: string | string[];
120
116
  verbose?: boolean;
121
117
  strict?: boolean;
118
+ casing?: 'camelCase' | 'snake_case';
122
119
  migrations?: {
123
120
  table?: string;
124
121
  schema?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.25.0-1fba875",
3
+ "version": "0.25.0-20acc2f",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -80,7 +80,7 @@
80
80
  "commander": "^12.1.0",
81
81
  "dockerode": "^3.3.4",
82
82
  "dotenv": "^16.0.3",
83
- "drizzle-kit": "0.21.2",
83
+ "drizzle-kit": "0.25.0-b1faa33",
84
84
  "drizzle-orm": "workspace:./drizzle-orm/dist",
85
85
  "env-paths": "^3.0.0",
86
86
  "esbuild-node-externals": "^1.9.0",
package/utils.js CHANGED
@@ -569,6 +569,7 @@ __export(utils_exports, {
569
569
  copy: () => copy,
570
570
  dryJournal: () => dryJournal,
571
571
  findAddedAndRemoved: () => findAddedAndRemoved,
572
+ getColumnCasing: () => getColumnCasing,
572
573
  isPgArrayType: () => isPgArrayType,
573
574
  kloudMeta: () => kloudMeta,
574
575
  normalisePGliteUrl: () => normalisePGliteUrl,
@@ -1073,6 +1074,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1073
1074
  var source_default = chalk;
1074
1075
 
1075
1076
  // src/utils.ts
1077
+ var import_casing = require("drizzle-orm/casing");
1076
1078
  var import_fs = require("fs");
1077
1079
  var import_path = require("path");
1078
1080
  var import_url = require("url");
@@ -4901,6 +4903,10 @@ var uniqueConstraint = objectType({
4901
4903
  name: stringType(),
4902
4904
  columns: stringType().array()
4903
4905
  }).strict();
4906
+ var checkConstraint = objectType({
4907
+ name: stringType(),
4908
+ value: stringType()
4909
+ }).strict();
4904
4910
  var tableV4 = objectType({
4905
4911
  name: stringType(),
4906
4912
  schema: stringType().optional(),
@@ -4914,7 +4920,8 @@ var table = objectType({
4914
4920
  indexes: recordType(stringType(), index),
4915
4921
  foreignKeys: recordType(stringType(), fk),
4916
4922
  compositePrimaryKeys: recordType(stringType(), compositePK),
4917
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4923
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4924
+ checkConstraint: recordType(stringType(), checkConstraint).default({})
4918
4925
  }).strict();
4919
4926
  var kitInternals = objectType({
4920
4927
  tables: recordType(
@@ -4991,7 +4998,8 @@ var tableSquashed = objectType({
4991
4998
  indexes: recordType(stringType(), stringType()),
4992
4999
  foreignKeys: recordType(stringType(), stringType()),
4993
5000
  compositePrimaryKeys: recordType(stringType(), stringType()),
4994
- uniqueConstraints: recordType(stringType(), stringType()).default({})
5001
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5002
+ checkConstraints: recordType(stringType(), stringType()).default({})
4995
5003
  }).strict();
4996
5004
  var schemaSquashed = objectType({
4997
5005
  version: literalType("5"),
@@ -5179,6 +5187,10 @@ var column2 = objectType({
5179
5187
  }).optional(),
5180
5188
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5181
5189
  }).strict();
5190
+ var checkConstraint2 = objectType({
5191
+ name: stringType(),
5192
+ value: stringType()
5193
+ }).strict();
5182
5194
  var columnSquashed = objectType({
5183
5195
  name: stringType(),
5184
5196
  type: stringType(),
@@ -5251,7 +5263,8 @@ var table2 = objectType({
5251
5263
  indexes: recordType(stringType(), index2),
5252
5264
  foreignKeys: recordType(stringType(), fk2),
5253
5265
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5254
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5266
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5267
+ checkConstraints: recordType(stringType(), checkConstraint2).default({})
5255
5268
  }).strict();
5256
5269
  var schemaHash2 = objectType({
5257
5270
  id: stringType(),
@@ -5359,7 +5372,8 @@ var tableSquashed2 = objectType({
5359
5372
  indexes: recordType(stringType(), stringType()),
5360
5373
  foreignKeys: recordType(stringType(), stringType()),
5361
5374
  compositePrimaryKeys: recordType(stringType(), stringType()),
5362
- uniqueConstraints: recordType(stringType(), stringType())
5375
+ uniqueConstraints: recordType(stringType(), stringType()),
5376
+ checkConstraints: recordType(stringType(), stringType())
5363
5377
  }).strict();
5364
5378
  var tableSquashedV42 = objectType({
5365
5379
  name: stringType(),
@@ -5459,13 +5473,18 @@ var uniqueConstraint3 = objectType({
5459
5473
  name: stringType(),
5460
5474
  columns: stringType().array()
5461
5475
  }).strict();
5476
+ var checkConstraint3 = objectType({
5477
+ name: stringType(),
5478
+ value: stringType()
5479
+ }).strict();
5462
5480
  var table3 = objectType({
5463
5481
  name: stringType(),
5464
5482
  columns: recordType(stringType(), column3),
5465
5483
  indexes: recordType(stringType(), index3),
5466
5484
  foreignKeys: recordType(stringType(), fk3),
5467
5485
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5468
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5486
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5487
+ checkConstraints: recordType(stringType(), checkConstraint3).default({})
5469
5488
  }).strict();
5470
5489
  var dialect2 = enumType(["sqlite"]);
5471
5490
  var schemaHash3 = objectType({
@@ -5527,7 +5546,8 @@ var tableSquashed3 = objectType({
5527
5546
  indexes: recordType(stringType(), stringType()),
5528
5547
  foreignKeys: recordType(stringType(), stringType()),
5529
5548
  compositePrimaryKeys: recordType(stringType(), stringType()),
5530
- uniqueConstraints: recordType(stringType(), stringType()).default({})
5549
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5550
+ checkConstraints: recordType(stringType(), stringType()).default({})
5531
5551
  }).strict();
5532
5552
  var schemaSquashed2 = objectType({
5533
5553
  version: latestVersion,
@@ -5760,6 +5780,11 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5760
5780
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5761
5781
  return { addedColumns, removedColumns };
5762
5782
  }
5783
+ function getColumnCasing(column4, casing) {
5784
+ if (!column4.name)
5785
+ return "";
5786
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? (0, import_casing.toCamelCase)(column4.name) : (0, import_casing.toSnakeCase)(column4.name);
5787
+ }
5763
5788
  // Annotate the CommonJS export names for ESM import in node:
5764
5789
  0 && (module.exports = {
5765
5790
  assertV1OutFolder,
@@ -5767,6 +5792,7 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5767
5792
  copy,
5768
5793
  dryJournal,
5769
5794
  findAddedAndRemoved,
5795
+ getColumnCasing,
5770
5796
  isPgArrayType,
5771
5797
  kloudMeta,
5772
5798
  normalisePGliteUrl,
package/utils.mjs CHANGED
@@ -1052,6 +1052,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1052
1052
  var source_default = chalk;
1053
1053
 
1054
1054
  // src/utils.ts
1055
+ import { toCamelCase, toSnakeCase } from "drizzle-orm/casing";
1055
1056
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
1056
1057
  import { join } from "path";
1057
1058
  import { parse } from "url";
@@ -4880,6 +4881,10 @@ var uniqueConstraint = objectType({
4880
4881
  name: stringType(),
4881
4882
  columns: stringType().array()
4882
4883
  }).strict();
4884
+ var checkConstraint = objectType({
4885
+ name: stringType(),
4886
+ value: stringType()
4887
+ }).strict();
4883
4888
  var tableV4 = objectType({
4884
4889
  name: stringType(),
4885
4890
  schema: stringType().optional(),
@@ -4893,7 +4898,8 @@ var table = objectType({
4893
4898
  indexes: recordType(stringType(), index),
4894
4899
  foreignKeys: recordType(stringType(), fk),
4895
4900
  compositePrimaryKeys: recordType(stringType(), compositePK),
4896
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4901
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4902
+ checkConstraint: recordType(stringType(), checkConstraint).default({})
4897
4903
  }).strict();
4898
4904
  var kitInternals = objectType({
4899
4905
  tables: recordType(
@@ -4970,7 +4976,8 @@ var tableSquashed = objectType({
4970
4976
  indexes: recordType(stringType(), stringType()),
4971
4977
  foreignKeys: recordType(stringType(), stringType()),
4972
4978
  compositePrimaryKeys: recordType(stringType(), stringType()),
4973
- uniqueConstraints: recordType(stringType(), stringType()).default({})
4979
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
4980
+ checkConstraints: recordType(stringType(), stringType()).default({})
4974
4981
  }).strict();
4975
4982
  var schemaSquashed = objectType({
4976
4983
  version: literalType("5"),
@@ -5158,6 +5165,10 @@ var column2 = objectType({
5158
5165
  }).optional(),
5159
5166
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5160
5167
  }).strict();
5168
+ var checkConstraint2 = objectType({
5169
+ name: stringType(),
5170
+ value: stringType()
5171
+ }).strict();
5161
5172
  var columnSquashed = objectType({
5162
5173
  name: stringType(),
5163
5174
  type: stringType(),
@@ -5230,7 +5241,8 @@ var table2 = objectType({
5230
5241
  indexes: recordType(stringType(), index2),
5231
5242
  foreignKeys: recordType(stringType(), fk2),
5232
5243
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5233
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5244
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5245
+ checkConstraints: recordType(stringType(), checkConstraint2).default({})
5234
5246
  }).strict();
5235
5247
  var schemaHash2 = objectType({
5236
5248
  id: stringType(),
@@ -5338,7 +5350,8 @@ var tableSquashed2 = objectType({
5338
5350
  indexes: recordType(stringType(), stringType()),
5339
5351
  foreignKeys: recordType(stringType(), stringType()),
5340
5352
  compositePrimaryKeys: recordType(stringType(), stringType()),
5341
- uniqueConstraints: recordType(stringType(), stringType())
5353
+ uniqueConstraints: recordType(stringType(), stringType()),
5354
+ checkConstraints: recordType(stringType(), stringType())
5342
5355
  }).strict();
5343
5356
  var tableSquashedV42 = objectType({
5344
5357
  name: stringType(),
@@ -5438,13 +5451,18 @@ var uniqueConstraint3 = objectType({
5438
5451
  name: stringType(),
5439
5452
  columns: stringType().array()
5440
5453
  }).strict();
5454
+ var checkConstraint3 = objectType({
5455
+ name: stringType(),
5456
+ value: stringType()
5457
+ }).strict();
5441
5458
  var table3 = objectType({
5442
5459
  name: stringType(),
5443
5460
  columns: recordType(stringType(), column3),
5444
5461
  indexes: recordType(stringType(), index3),
5445
5462
  foreignKeys: recordType(stringType(), fk3),
5446
5463
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5447
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5464
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5465
+ checkConstraints: recordType(stringType(), checkConstraint3).default({})
5448
5466
  }).strict();
5449
5467
  var dialect2 = enumType(["sqlite"]);
5450
5468
  var schemaHash3 = objectType({
@@ -5506,7 +5524,8 @@ var tableSquashed3 = objectType({
5506
5524
  indexes: recordType(stringType(), stringType()),
5507
5525
  foreignKeys: recordType(stringType(), stringType()),
5508
5526
  compositePrimaryKeys: recordType(stringType(), stringType()),
5509
- uniqueConstraints: recordType(stringType(), stringType()).default({})
5527
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
5528
+ checkConstraints: recordType(stringType(), stringType()).default({})
5510
5529
  }).strict();
5511
5530
  var schemaSquashed2 = objectType({
5512
5531
  version: latestVersion,
@@ -5739,12 +5758,18 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5739
5758
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5740
5759
  return { addedColumns, removedColumns };
5741
5760
  }
5761
+ function getColumnCasing(column4, casing) {
5762
+ if (!column4.name)
5763
+ return "";
5764
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
5765
+ }
5742
5766
  export {
5743
5767
  assertV1OutFolder,
5744
5768
  columnRenameKey,
5745
5769
  copy,
5746
5770
  dryJournal,
5747
5771
  findAddedAndRemoved,
5772
+ getColumnCasing,
5748
5773
  isPgArrayType,
5749
5774
  kloudMeta,
5750
5775
  normalisePGliteUrl,