drizzle-kit 0.26.2-7fcf6f9 → 0.26.2-9f627ed
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +170 -8
- package/api.d.ts +170 -8
- package/api.js +2408 -1178
- package/api.mjs +2408 -1178
- package/bin.cjs +1694 -355
- package/index.d.mts +7 -0
- package/index.d.ts +7 -0
- package/package.json +4 -4
- package/utils.js +32 -11
- package/utils.mjs +32 -10
package/index.d.mts
CHANGED
@@ -124,6 +124,13 @@ type Config = {
|
|
124
124
|
introspect?: {
|
125
125
|
casing: 'camel' | 'preserve';
|
126
126
|
};
|
127
|
+
entities?: {
|
128
|
+
roles?: boolean | {
|
129
|
+
provider?: 'supabase' | 'neon' | string & {};
|
130
|
+
exclude?: string[];
|
131
|
+
include?: string[];
|
132
|
+
};
|
133
|
+
};
|
127
134
|
} & ({
|
128
135
|
dialect: Verify<Dialect, 'turso'>;
|
129
136
|
dbCredentials: {
|
package/index.d.ts
CHANGED
@@ -124,6 +124,13 @@ type Config = {
|
|
124
124
|
introspect?: {
|
125
125
|
casing: 'camel' | 'preserve';
|
126
126
|
};
|
127
|
+
entities?: {
|
128
|
+
roles?: boolean | {
|
129
|
+
provider?: 'supabase' | 'neon' | string & {};
|
130
|
+
exclude?: string[];
|
131
|
+
include?: string[];
|
132
|
+
};
|
133
|
+
};
|
127
134
|
} & ({
|
128
135
|
dialect: Verify<Dialect, 'turso'>;
|
129
136
|
dbCredentials: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.26.2-
|
3
|
+
"version": "0.26.2-9f627ed",
|
4
4
|
"homepage": "https://orm.drizzle.team",
|
5
5
|
"keywords": [
|
6
6
|
"drizzle",
|
@@ -34,11 +34,11 @@
|
|
34
34
|
"api": "tsx ./dev/api.ts",
|
35
35
|
"migrate:old": "drizzle-kit generate:mysql",
|
36
36
|
"cli": "tsx ./src/cli/index.ts",
|
37
|
-
"test": "TEST_CONFIG_PATH_PREFIX=./tests/cli/ vitest",
|
37
|
+
"test": "pnpm tsc && TEST_CONFIG_PATH_PREFIX=./tests/cli/ vitest",
|
38
38
|
"build": "rm -rf ./dist && tsx build.ts && cp package.json dist/ && attw --pack dist",
|
39
39
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
40
40
|
"pack": "cp package.json README.md dist/ && (cd dist && npm pack --pack-destination ..) && rm -f package.tgz && mv *.tgz package.tgz",
|
41
|
-
"tsc": "tsc -p tsconfig.build.json",
|
41
|
+
"tsc": "tsc -p tsconfig.build.json --noEmit",
|
42
42
|
"publish": "npm publish package.tgz"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
@@ -103,7 +103,7 @@
|
|
103
103
|
"superjson": "^2.2.1",
|
104
104
|
"tsup": "^8.0.2",
|
105
105
|
"tsx": "^3.12.1",
|
106
|
-
"typescript": "^5.
|
106
|
+
"typescript": "^5.6.3",
|
107
107
|
"uuid": "^9.0.1",
|
108
108
|
"vite-tsconfig-paths": "^4.3.2",
|
109
109
|
"vitest": "^1.4.0",
|
package/utils.js
CHANGED
@@ -569,7 +569,6 @@ __export(utils_exports, {
|
|
569
569
|
copy: () => copy,
|
570
570
|
dryJournal: () => dryJournal,
|
571
571
|
findAddedAndRemoved: () => findAddedAndRemoved,
|
572
|
-
getColumnCasing: () => getColumnCasing,
|
573
572
|
isPgArrayType: () => isPgArrayType,
|
574
573
|
kloudMeta: () => kloudMeta,
|
575
574
|
normalisePGliteUrl: () => normalisePGliteUrl,
|
@@ -1074,7 +1073,6 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1074
1073
|
var source_default = chalk;
|
1075
1074
|
|
1076
1075
|
// src/utils.ts
|
1077
|
-
var import_casing = require("drizzle-orm/casing");
|
1078
1076
|
var import_fs = require("fs");
|
1079
1077
|
var import_path = require("path");
|
1080
1078
|
var import_url = require("url");
|
@@ -5174,6 +5172,12 @@ var sequenceSchema = objectType({
|
|
5174
5172
|
cycle: booleanType().optional(),
|
5175
5173
|
schema: stringType()
|
5176
5174
|
}).strict();
|
5175
|
+
var roleSchema = objectType({
|
5176
|
+
name: stringType(),
|
5177
|
+
createDb: booleanType().optional(),
|
5178
|
+
createRole: booleanType().optional(),
|
5179
|
+
inherit: booleanType().optional()
|
5180
|
+
}).strict();
|
5177
5181
|
var sequenceSquashed = objectType({
|
5178
5182
|
name: stringType(),
|
5179
5183
|
schema: stringType(),
|
@@ -5241,6 +5245,19 @@ var uniqueConstraint2 = objectType({
|
|
5241
5245
|
columns: stringType().array(),
|
5242
5246
|
nullsNotDistinct: booleanType()
|
5243
5247
|
}).strict();
|
5248
|
+
var policy = objectType({
|
5249
|
+
name: stringType(),
|
5250
|
+
as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
|
5251
|
+
for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
|
5252
|
+
to: stringType().array().optional(),
|
5253
|
+
using: stringType().optional(),
|
5254
|
+
withCheck: stringType().optional(),
|
5255
|
+
on: stringType().optional()
|
5256
|
+
}).strict();
|
5257
|
+
var policySquashed = objectType({
|
5258
|
+
name: stringType(),
|
5259
|
+
values: stringType()
|
5260
|
+
}).strict();
|
5244
5261
|
var viewWithOption = objectType({
|
5245
5262
|
checkOption: enumType(["local", "cascaded"]).optional(),
|
5246
5263
|
securityBarrier: booleanType().optional(),
|
@@ -5321,7 +5338,9 @@ var table2 = objectType({
|
|
5321
5338
|
foreignKeys: recordType(stringType(), fk2),
|
5322
5339
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5323
5340
|
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
|
5324
|
-
|
5341
|
+
policies: recordType(stringType(), policy).default({}),
|
5342
|
+
checkConstraints: recordType(stringType(), checkConstraint2).default({}),
|
5343
|
+
isRLSEnabled: booleanType().default(false)
|
5325
5344
|
}).strict();
|
5326
5345
|
var schemaHash2 = objectType({
|
5327
5346
|
id: stringType(),
|
@@ -5416,6 +5435,8 @@ var pgSchemaInternal = objectType({
|
|
5416
5435
|
schemas: recordType(stringType(), stringType()),
|
5417
5436
|
views: recordType(stringType(), view2).default({}),
|
5418
5437
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
5438
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5439
|
+
policies: recordType(stringType(), policy).default({}),
|
5419
5440
|
_meta: objectType({
|
5420
5441
|
schemas: recordType(stringType(), stringType()),
|
5421
5442
|
tables: recordType(stringType(), stringType()),
|
@@ -5431,7 +5452,9 @@ var tableSquashed2 = objectType({
|
|
5431
5452
|
foreignKeys: recordType(stringType(), stringType()),
|
5432
5453
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5433
5454
|
uniqueConstraints: recordType(stringType(), stringType()),
|
5434
|
-
|
5455
|
+
policies: recordType(stringType(), stringType()),
|
5456
|
+
checkConstraints: recordType(stringType(), stringType()),
|
5457
|
+
isRLSEnabled: booleanType().default(false)
|
5435
5458
|
}).strict();
|
5436
5459
|
var tableSquashedV42 = objectType({
|
5437
5460
|
name: stringType(),
|
@@ -5461,7 +5484,9 @@ var pgSchemaSquashed = objectType({
|
|
5461
5484
|
enums: recordType(stringType(), enumSchema),
|
5462
5485
|
schemas: recordType(stringType(), stringType()),
|
5463
5486
|
views: recordType(stringType(), view2),
|
5464
|
-
sequences: recordType(stringType(), sequenceSquashed)
|
5487
|
+
sequences: recordType(stringType(), sequenceSquashed),
|
5488
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5489
|
+
policies: recordType(stringType(), policy).default({})
|
5465
5490
|
}).strict();
|
5466
5491
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5467
5492
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -5482,6 +5507,8 @@ var dryPg = pgSchema.parse({
|
|
5482
5507
|
tables: {},
|
5483
5508
|
enums: {},
|
5484
5509
|
schemas: {},
|
5510
|
+
policies: {},
|
5511
|
+
roles: {},
|
5485
5512
|
sequences: {},
|
5486
5513
|
_meta: {
|
5487
5514
|
schemas: {},
|
@@ -5849,11 +5876,6 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
|
|
5849
5876
|
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
5850
5877
|
return { addedColumns, removedColumns };
|
5851
5878
|
}
|
5852
|
-
function getColumnCasing(column4, casing) {
|
5853
|
-
if (!column4.name)
|
5854
|
-
return "";
|
5855
|
-
return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? (0, import_casing.toCamelCase)(column4.name) : (0, import_casing.toSnakeCase)(column4.name);
|
5856
|
-
}
|
5857
5879
|
// Annotate the CommonJS export names for ESM import in node:
|
5858
5880
|
0 && (module.exports = {
|
5859
5881
|
assertV1OutFolder,
|
@@ -5861,7 +5883,6 @@ function getColumnCasing(column4, casing) {
|
|
5861
5883
|
copy,
|
5862
5884
|
dryJournal,
|
5863
5885
|
findAddedAndRemoved,
|
5864
|
-
getColumnCasing,
|
5865
5886
|
isPgArrayType,
|
5866
5887
|
kloudMeta,
|
5867
5888
|
normalisePGliteUrl,
|
package/utils.mjs
CHANGED
@@ -1052,7 +1052,6 @@ 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";
|
1056
1055
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
|
1057
1056
|
import { join } from "path";
|
1058
1057
|
import { parse } from "url";
|
@@ -5152,6 +5151,12 @@ var sequenceSchema = objectType({
|
|
5152
5151
|
cycle: booleanType().optional(),
|
5153
5152
|
schema: stringType()
|
5154
5153
|
}).strict();
|
5154
|
+
var roleSchema = objectType({
|
5155
|
+
name: stringType(),
|
5156
|
+
createDb: booleanType().optional(),
|
5157
|
+
createRole: booleanType().optional(),
|
5158
|
+
inherit: booleanType().optional()
|
5159
|
+
}).strict();
|
5155
5160
|
var sequenceSquashed = objectType({
|
5156
5161
|
name: stringType(),
|
5157
5162
|
schema: stringType(),
|
@@ -5219,6 +5224,19 @@ var uniqueConstraint2 = objectType({
|
|
5219
5224
|
columns: stringType().array(),
|
5220
5225
|
nullsNotDistinct: booleanType()
|
5221
5226
|
}).strict();
|
5227
|
+
var policy = objectType({
|
5228
|
+
name: stringType(),
|
5229
|
+
as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
|
5230
|
+
for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
|
5231
|
+
to: stringType().array().optional(),
|
5232
|
+
using: stringType().optional(),
|
5233
|
+
withCheck: stringType().optional(),
|
5234
|
+
on: stringType().optional()
|
5235
|
+
}).strict();
|
5236
|
+
var policySquashed = objectType({
|
5237
|
+
name: stringType(),
|
5238
|
+
values: stringType()
|
5239
|
+
}).strict();
|
5222
5240
|
var viewWithOption = objectType({
|
5223
5241
|
checkOption: enumType(["local", "cascaded"]).optional(),
|
5224
5242
|
securityBarrier: booleanType().optional(),
|
@@ -5299,7 +5317,9 @@ var table2 = objectType({
|
|
5299
5317
|
foreignKeys: recordType(stringType(), fk2),
|
5300
5318
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5301
5319
|
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
|
5302
|
-
|
5320
|
+
policies: recordType(stringType(), policy).default({}),
|
5321
|
+
checkConstraints: recordType(stringType(), checkConstraint2).default({}),
|
5322
|
+
isRLSEnabled: booleanType().default(false)
|
5303
5323
|
}).strict();
|
5304
5324
|
var schemaHash2 = objectType({
|
5305
5325
|
id: stringType(),
|
@@ -5394,6 +5414,8 @@ var pgSchemaInternal = objectType({
|
|
5394
5414
|
schemas: recordType(stringType(), stringType()),
|
5395
5415
|
views: recordType(stringType(), view2).default({}),
|
5396
5416
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
5417
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5418
|
+
policies: recordType(stringType(), policy).default({}),
|
5397
5419
|
_meta: objectType({
|
5398
5420
|
schemas: recordType(stringType(), stringType()),
|
5399
5421
|
tables: recordType(stringType(), stringType()),
|
@@ -5409,7 +5431,9 @@ var tableSquashed2 = objectType({
|
|
5409
5431
|
foreignKeys: recordType(stringType(), stringType()),
|
5410
5432
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5411
5433
|
uniqueConstraints: recordType(stringType(), stringType()),
|
5412
|
-
|
5434
|
+
policies: recordType(stringType(), stringType()),
|
5435
|
+
checkConstraints: recordType(stringType(), stringType()),
|
5436
|
+
isRLSEnabled: booleanType().default(false)
|
5413
5437
|
}).strict();
|
5414
5438
|
var tableSquashedV42 = objectType({
|
5415
5439
|
name: stringType(),
|
@@ -5439,7 +5463,9 @@ var pgSchemaSquashed = objectType({
|
|
5439
5463
|
enums: recordType(stringType(), enumSchema),
|
5440
5464
|
schemas: recordType(stringType(), stringType()),
|
5441
5465
|
views: recordType(stringType(), view2),
|
5442
|
-
sequences: recordType(stringType(), sequenceSquashed)
|
5466
|
+
sequences: recordType(stringType(), sequenceSquashed),
|
5467
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5468
|
+
policies: recordType(stringType(), policy).default({})
|
5443
5469
|
}).strict();
|
5444
5470
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5445
5471
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -5460,6 +5486,8 @@ var dryPg = pgSchema.parse({
|
|
5460
5486
|
tables: {},
|
5461
5487
|
enums: {},
|
5462
5488
|
schemas: {},
|
5489
|
+
policies: {},
|
5490
|
+
roles: {},
|
5463
5491
|
sequences: {},
|
5464
5492
|
_meta: {
|
5465
5493
|
schemas: {},
|
@@ -5827,18 +5855,12 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
|
|
5827
5855
|
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
5828
5856
|
return { addedColumns, removedColumns };
|
5829
5857
|
}
|
5830
|
-
function getColumnCasing(column4, casing) {
|
5831
|
-
if (!column4.name)
|
5832
|
-
return "";
|
5833
|
-
return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
|
5834
|
-
}
|
5835
5858
|
export {
|
5836
5859
|
assertV1OutFolder,
|
5837
5860
|
columnRenameKey,
|
5838
5861
|
copy,
|
5839
5862
|
dryJournal,
|
5840
5863
|
findAddedAndRemoved,
|
5841
|
-
getColumnCasing,
|
5842
5864
|
isPgArrayType,
|
5843
5865
|
kloudMeta,
|
5844
5866
|
normalisePGliteUrl,
|