drizzle-kit 0.25.0-5a1c5d3 → 0.25.0-665fa03

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-5a1c5d3",
3
+ "version": "0.25.0-665fa03",
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,10 +4903,6 @@ var uniqueConstraint = objectType({
4901
4903
  name: stringType(),
4902
4904
  columns: stringType().array()
4903
4905
  }).strict();
4904
- var checkConstraint = objectType({
4905
- name: stringType(),
4906
- value: stringType()
4907
- }).strict();
4908
4906
  var tableV4 = objectType({
4909
4907
  name: stringType(),
4910
4908
  schema: stringType().optional(),
@@ -4918,8 +4916,7 @@ var table = objectType({
4918
4916
  indexes: recordType(stringType(), index),
4919
4917
  foreignKeys: recordType(stringType(), fk),
4920
4918
  compositePrimaryKeys: recordType(stringType(), compositePK),
4921
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4922
- checkConstraint: recordType(stringType(), checkConstraint).default({})
4919
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4923
4920
  }).strict();
4924
4921
  var kitInternals = objectType({
4925
4922
  tables: recordType(
@@ -4996,8 +4993,7 @@ var tableSquashed = objectType({
4996
4993
  indexes: recordType(stringType(), stringType()),
4997
4994
  foreignKeys: recordType(stringType(), stringType()),
4998
4995
  compositePrimaryKeys: recordType(stringType(), stringType()),
4999
- uniqueConstraints: recordType(stringType(), stringType()).default({}),
5000
- checkConstraints: recordType(stringType(), stringType()).default({})
4996
+ uniqueConstraints: recordType(stringType(), stringType()).default({})
5001
4997
  }).strict();
5002
4998
  var schemaSquashed = objectType({
5003
4999
  version: literalType("5"),
@@ -5185,10 +5181,6 @@ var column2 = objectType({
5185
5181
  }).optional(),
5186
5182
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5187
5183
  }).strict();
5188
- var checkConstraint2 = objectType({
5189
- name: stringType(),
5190
- value: stringType()
5191
- }).strict();
5192
5184
  var columnSquashed = objectType({
5193
5185
  name: stringType(),
5194
5186
  type: stringType(),
@@ -5261,8 +5253,7 @@ var table2 = objectType({
5261
5253
  indexes: recordType(stringType(), index2),
5262
5254
  foreignKeys: recordType(stringType(), fk2),
5263
5255
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5264
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5265
- checkConstraints: recordType(stringType(), checkConstraint2).default({})
5256
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5266
5257
  }).strict();
5267
5258
  var schemaHash2 = objectType({
5268
5259
  id: stringType(),
@@ -5370,8 +5361,7 @@ var tableSquashed2 = objectType({
5370
5361
  indexes: recordType(stringType(), stringType()),
5371
5362
  foreignKeys: recordType(stringType(), stringType()),
5372
5363
  compositePrimaryKeys: recordType(stringType(), stringType()),
5373
- uniqueConstraints: recordType(stringType(), stringType()),
5374
- checkConstraints: recordType(stringType(), stringType())
5364
+ uniqueConstraints: recordType(stringType(), stringType())
5375
5365
  }).strict();
5376
5366
  var tableSquashedV42 = objectType({
5377
5367
  name: stringType(),
@@ -5471,18 +5461,13 @@ var uniqueConstraint3 = objectType({
5471
5461
  name: stringType(),
5472
5462
  columns: stringType().array()
5473
5463
  }).strict();
5474
- var checkConstraint3 = objectType({
5475
- name: stringType(),
5476
- value: stringType()
5477
- }).strict();
5478
5464
  var table3 = objectType({
5479
5465
  name: stringType(),
5480
5466
  columns: recordType(stringType(), column3),
5481
5467
  indexes: recordType(stringType(), index3),
5482
5468
  foreignKeys: recordType(stringType(), fk3),
5483
5469
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5484
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5485
- checkConstraints: recordType(stringType(), checkConstraint3).default({})
5470
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5486
5471
  }).strict();
5487
5472
  var dialect2 = enumType(["sqlite"]);
5488
5473
  var schemaHash3 = objectType({
@@ -5544,8 +5529,7 @@ var tableSquashed3 = objectType({
5544
5529
  indexes: recordType(stringType(), stringType()),
5545
5530
  foreignKeys: recordType(stringType(), stringType()),
5546
5531
  compositePrimaryKeys: recordType(stringType(), stringType()),
5547
- uniqueConstraints: recordType(stringType(), stringType()).default({}),
5548
- checkConstraints: recordType(stringType(), stringType()).default({})
5532
+ uniqueConstraints: recordType(stringType(), stringType()).default({})
5549
5533
  }).strict();
5550
5534
  var schemaSquashed2 = objectType({
5551
5535
  version: latestVersion,
@@ -5778,6 +5762,11 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5778
5762
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5779
5763
  return { addedColumns, removedColumns };
5780
5764
  }
5765
+ function getColumnCasing(column4, casing) {
5766
+ if (!column4.name)
5767
+ return "";
5768
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? (0, import_casing.toCamelCase)(column4.name) : (0, import_casing.toSnakeCase)(column4.name);
5769
+ }
5781
5770
  // Annotate the CommonJS export names for ESM import in node:
5782
5771
  0 && (module.exports = {
5783
5772
  assertV1OutFolder,
@@ -5785,6 +5774,7 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5785
5774
  copy,
5786
5775
  dryJournal,
5787
5776
  findAddedAndRemoved,
5777
+ getColumnCasing,
5788
5778
  isPgArrayType,
5789
5779
  kloudMeta,
5790
5780
  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,10 +4881,6 @@ var uniqueConstraint = objectType({
4880
4881
  name: stringType(),
4881
4882
  columns: stringType().array()
4882
4883
  }).strict();
4883
- var checkConstraint = objectType({
4884
- name: stringType(),
4885
- value: stringType()
4886
- }).strict();
4887
4884
  var tableV4 = objectType({
4888
4885
  name: stringType(),
4889
4886
  schema: stringType().optional(),
@@ -4897,8 +4894,7 @@ var table = objectType({
4897
4894
  indexes: recordType(stringType(), index),
4898
4895
  foreignKeys: recordType(stringType(), fk),
4899
4896
  compositePrimaryKeys: recordType(stringType(), compositePK),
4900
- uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4901
- checkConstraint: recordType(stringType(), checkConstraint).default({})
4897
+ uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
4902
4898
  }).strict();
4903
4899
  var kitInternals = objectType({
4904
4900
  tables: recordType(
@@ -4975,8 +4971,7 @@ var tableSquashed = objectType({
4975
4971
  indexes: recordType(stringType(), stringType()),
4976
4972
  foreignKeys: recordType(stringType(), stringType()),
4977
4973
  compositePrimaryKeys: recordType(stringType(), stringType()),
4978
- uniqueConstraints: recordType(stringType(), stringType()).default({}),
4979
- checkConstraints: recordType(stringType(), stringType()).default({})
4974
+ uniqueConstraints: recordType(stringType(), stringType()).default({})
4980
4975
  }).strict();
4981
4976
  var schemaSquashed = objectType({
4982
4977
  version: literalType("5"),
@@ -5164,10 +5159,6 @@ var column2 = objectType({
5164
5159
  }).optional(),
5165
5160
  identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5166
5161
  }).strict();
5167
- var checkConstraint2 = objectType({
5168
- name: stringType(),
5169
- value: stringType()
5170
- }).strict();
5171
5162
  var columnSquashed = objectType({
5172
5163
  name: stringType(),
5173
5164
  type: stringType(),
@@ -5240,8 +5231,7 @@ var table2 = objectType({
5240
5231
  indexes: recordType(stringType(), index2),
5241
5232
  foreignKeys: recordType(stringType(), fk2),
5242
5233
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5243
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5244
- checkConstraints: recordType(stringType(), checkConstraint2).default({})
5234
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5245
5235
  }).strict();
5246
5236
  var schemaHash2 = objectType({
5247
5237
  id: stringType(),
@@ -5349,8 +5339,7 @@ var tableSquashed2 = objectType({
5349
5339
  indexes: recordType(stringType(), stringType()),
5350
5340
  foreignKeys: recordType(stringType(), stringType()),
5351
5341
  compositePrimaryKeys: recordType(stringType(), stringType()),
5352
- uniqueConstraints: recordType(stringType(), stringType()),
5353
- checkConstraints: recordType(stringType(), stringType())
5342
+ uniqueConstraints: recordType(stringType(), stringType())
5354
5343
  }).strict();
5355
5344
  var tableSquashedV42 = objectType({
5356
5345
  name: stringType(),
@@ -5450,18 +5439,13 @@ var uniqueConstraint3 = objectType({
5450
5439
  name: stringType(),
5451
5440
  columns: stringType().array()
5452
5441
  }).strict();
5453
- var checkConstraint3 = objectType({
5454
- name: stringType(),
5455
- value: stringType()
5456
- }).strict();
5457
5442
  var table3 = objectType({
5458
5443
  name: stringType(),
5459
5444
  columns: recordType(stringType(), column3),
5460
5445
  indexes: recordType(stringType(), index3),
5461
5446
  foreignKeys: recordType(stringType(), fk3),
5462
5447
  compositePrimaryKeys: recordType(stringType(), compositePK3),
5463
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5464
- checkConstraints: recordType(stringType(), checkConstraint3).default({})
5448
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5465
5449
  }).strict();
5466
5450
  var dialect2 = enumType(["sqlite"]);
5467
5451
  var schemaHash3 = objectType({
@@ -5523,8 +5507,7 @@ var tableSquashed3 = objectType({
5523
5507
  indexes: recordType(stringType(), stringType()),
5524
5508
  foreignKeys: recordType(stringType(), stringType()),
5525
5509
  compositePrimaryKeys: recordType(stringType(), stringType()),
5526
- uniqueConstraints: recordType(stringType(), stringType()).default({}),
5527
- checkConstraints: recordType(stringType(), stringType()).default({})
5510
+ uniqueConstraints: recordType(stringType(), stringType()).default({})
5528
5511
  }).strict();
5529
5512
  var schemaSquashed2 = objectType({
5530
5513
  version: latestVersion,
@@ -5757,12 +5740,18 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5757
5740
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5758
5741
  return { addedColumns, removedColumns };
5759
5742
  }
5743
+ function getColumnCasing(column4, casing) {
5744
+ if (!column4.name)
5745
+ return "";
5746
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
5747
+ }
5760
5748
  export {
5761
5749
  assertV1OutFolder,
5762
5750
  columnRenameKey,
5763
5751
  copy,
5764
5752
  dryJournal,
5765
5753
  findAddedAndRemoved,
5754
+ getColumnCasing,
5766
5755
  isPgArrayType,
5767
5756
  kloudMeta,
5768
5757
  normalisePGliteUrl,