drizzle-kit 0.25.0-b75016b → 0.25.0-bab5208

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;
@@ -127,13 +124,6 @@ type Config = {
127
124
  introspect?: {
128
125
  casing: 'camel' | 'preserve';
129
126
  };
130
- entities?: {
131
- roles?: boolean | {
132
- provider?: string;
133
- exclude?: string[];
134
- include?: string[];
135
- }[];
136
- };
137
127
  } & ({
138
128
  dialect: Verify<Dialect, 'turso'>;
139
129
  dbCredentials: {
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;
@@ -127,13 +124,6 @@ type Config = {
127
124
  introspect?: {
128
125
  casing: 'camel' | 'preserve';
129
126
  };
130
- entities?: {
131
- roles?: boolean | {
132
- provider?: string;
133
- exclude?: string[];
134
- include?: string[];
135
- }[];
136
- };
137
127
  } & ({
138
128
  dialect: Verify<Dialect, 'turso'>;
139
129
  dbCredentials: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.25.0-b75016b",
3
+ "version": "0.25.0-bab5208",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -51,7 +51,7 @@
51
51
  "@arethetypeswrong/cli": "^0.15.3",
52
52
  "@aws-sdk/client-rds-data": "^3.556.0",
53
53
  "@cloudflare/workers-types": "^4.20230518.0",
54
- "@electric-sql/pglite": "^0.2.5",
54
+ "@electric-sql/pglite": "^0.1.5",
55
55
  "@hono/node-server": "^1.9.0",
56
56
  "@hono/zod-validator": "^0.2.1",
57
57
  "@libsql/client": "^0.10.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");
@@ -5147,12 +5149,6 @@ var sequenceSchema = objectType({
5147
5149
  cycle: booleanType().optional(),
5148
5150
  schema: stringType()
5149
5151
  }).strict();
5150
- var roleSchema = objectType({
5151
- name: stringType(),
5152
- createDb: booleanType().optional(),
5153
- createRole: booleanType().optional(),
5154
- inherit: booleanType().optional()
5155
- }).strict();
5156
5152
  var sequenceSquashed = objectType({
5157
5153
  name: stringType(),
5158
5154
  schema: stringType(),
@@ -5216,14 +5212,6 @@ var uniqueConstraint2 = objectType({
5216
5212
  columns: stringType().array(),
5217
5213
  nullsNotDistinct: booleanType()
5218
5214
  }).strict();
5219
- var policy = objectType({
5220
- name: stringType(),
5221
- as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5222
- for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5223
- to: stringType().array().optional(),
5224
- using: stringType().optional(),
5225
- withCheck: stringType().optional()
5226
- }).strict();
5227
5215
  var tableV42 = objectType({
5228
5216
  name: stringType(),
5229
5217
  schema: stringType(),
@@ -5265,8 +5253,7 @@ var table2 = objectType({
5265
5253
  indexes: recordType(stringType(), index2),
5266
5254
  foreignKeys: recordType(stringType(), fk2),
5267
5255
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5268
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5269
- policies: recordType(stringType(), policy).default({})
5256
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5270
5257
  }).strict();
5271
5258
  var schemaHash2 = objectType({
5272
5259
  id: stringType(),
@@ -5360,7 +5347,6 @@ var pgSchemaInternal = objectType({
5360
5347
  enums: recordType(stringType(), enumSchema),
5361
5348
  schemas: recordType(stringType(), stringType()),
5362
5349
  sequences: recordType(stringType(), sequenceSchema).default({}),
5363
- roles: recordType(stringType(), roleSchema).default({}),
5364
5350
  _meta: objectType({
5365
5351
  schemas: recordType(stringType(), stringType()),
5366
5352
  tables: recordType(stringType(), stringType()),
@@ -5375,8 +5361,7 @@ var tableSquashed2 = objectType({
5375
5361
  indexes: recordType(stringType(), stringType()),
5376
5362
  foreignKeys: recordType(stringType(), stringType()),
5377
5363
  compositePrimaryKeys: recordType(stringType(), stringType()),
5378
- uniqueConstraints: recordType(stringType(), stringType()),
5379
- policies: recordType(stringType(), stringType())
5364
+ uniqueConstraints: recordType(stringType(), stringType())
5380
5365
  }).strict();
5381
5366
  var tableSquashedV42 = objectType({
5382
5367
  name: stringType(),
@@ -5405,8 +5390,7 @@ var pgSchemaSquashed = objectType({
5405
5390
  tables: recordType(stringType(), tableSquashed2),
5406
5391
  enums: recordType(stringType(), enumSchema),
5407
5392
  schemas: recordType(stringType(), stringType()),
5408
- sequences: recordType(stringType(), sequenceSquashed),
5409
- roles: recordType(stringType(), roleSchema).default({})
5393
+ sequences: recordType(stringType(), sequenceSquashed)
5410
5394
  }).strict();
5411
5395
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5412
5396
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -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";
@@ -5126,12 +5127,6 @@ var sequenceSchema = objectType({
5126
5127
  cycle: booleanType().optional(),
5127
5128
  schema: stringType()
5128
5129
  }).strict();
5129
- var roleSchema = objectType({
5130
- name: stringType(),
5131
- createDb: booleanType().optional(),
5132
- createRole: booleanType().optional(),
5133
- inherit: booleanType().optional()
5134
- }).strict();
5135
5130
  var sequenceSquashed = objectType({
5136
5131
  name: stringType(),
5137
5132
  schema: stringType(),
@@ -5195,14 +5190,6 @@ var uniqueConstraint2 = objectType({
5195
5190
  columns: stringType().array(),
5196
5191
  nullsNotDistinct: booleanType()
5197
5192
  }).strict();
5198
- var policy = objectType({
5199
- name: stringType(),
5200
- as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5201
- for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5202
- to: stringType().array().optional(),
5203
- using: stringType().optional(),
5204
- withCheck: stringType().optional()
5205
- }).strict();
5206
5193
  var tableV42 = objectType({
5207
5194
  name: stringType(),
5208
5195
  schema: stringType(),
@@ -5244,8 +5231,7 @@ var table2 = objectType({
5244
5231
  indexes: recordType(stringType(), index2),
5245
5232
  foreignKeys: recordType(stringType(), fk2),
5246
5233
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5247
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5248
- policies: recordType(stringType(), policy).default({})
5234
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5249
5235
  }).strict();
5250
5236
  var schemaHash2 = objectType({
5251
5237
  id: stringType(),
@@ -5339,7 +5325,6 @@ var pgSchemaInternal = objectType({
5339
5325
  enums: recordType(stringType(), enumSchema),
5340
5326
  schemas: recordType(stringType(), stringType()),
5341
5327
  sequences: recordType(stringType(), sequenceSchema).default({}),
5342
- roles: recordType(stringType(), roleSchema).default({}),
5343
5328
  _meta: objectType({
5344
5329
  schemas: recordType(stringType(), stringType()),
5345
5330
  tables: recordType(stringType(), stringType()),
@@ -5354,8 +5339,7 @@ var tableSquashed2 = objectType({
5354
5339
  indexes: recordType(stringType(), stringType()),
5355
5340
  foreignKeys: recordType(stringType(), stringType()),
5356
5341
  compositePrimaryKeys: recordType(stringType(), stringType()),
5357
- uniqueConstraints: recordType(stringType(), stringType()),
5358
- policies: recordType(stringType(), stringType())
5342
+ uniqueConstraints: recordType(stringType(), stringType())
5359
5343
  }).strict();
5360
5344
  var tableSquashedV42 = objectType({
5361
5345
  name: stringType(),
@@ -5384,8 +5368,7 @@ var pgSchemaSquashed = objectType({
5384
5368
  tables: recordType(stringType(), tableSquashed2),
5385
5369
  enums: recordType(stringType(), enumSchema),
5386
5370
  schemas: recordType(stringType(), stringType()),
5387
- sequences: recordType(stringType(), sequenceSquashed),
5388
- roles: recordType(stringType(), roleSchema).default({})
5371
+ sequences: recordType(stringType(), sequenceSquashed)
5389
5372
  }).strict();
5390
5373
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5391
5374
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -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,