drizzle-kit 0.24.2-cf2bc48 → 0.24.2-d496e6f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.d.mts +102 -6
- package/api.d.ts +102 -6
- package/api.js +90036 -14643
- package/api.mjs +90033 -14643
- package/bin.cjs +64827 -62632
- package/index.d.mts +13 -4
- package/index.d.ts +13 -4
- package/package.json +4 -4
- package/utils.js +65 -20
- package/utils.mjs +63 -20
package/index.d.mts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import { ConnectionOptions } from 'tls';
|
2
2
|
|
3
|
-
declare const
|
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"];
|
4
6
|
type Driver = (typeof drivers)[number];
|
5
7
|
|
6
|
-
declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
|
8
|
+
declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
|
7
9
|
type Dialect = (typeof dialects)[number];
|
8
10
|
|
9
11
|
type SslOptions = {
|
@@ -120,13 +122,20 @@ type Config = {
|
|
120
122
|
migrations?: {
|
121
123
|
table?: string;
|
122
124
|
schema?: string;
|
125
|
+
prefix?: Prefix;
|
123
126
|
};
|
124
127
|
introspect?: {
|
125
128
|
casing: 'camel' | 'preserve';
|
126
129
|
};
|
130
|
+
entities?: {
|
131
|
+
roles?: boolean | {
|
132
|
+
provider?: string;
|
133
|
+
exclude?: string[];
|
134
|
+
include?: string[];
|
135
|
+
}[];
|
136
|
+
};
|
127
137
|
} & ({
|
128
|
-
dialect: Verify<Dialect, '
|
129
|
-
driver: Verify<Driver, 'turso'>;
|
138
|
+
dialect: Verify<Dialect, 'turso'>;
|
130
139
|
dbCredentials: {
|
131
140
|
url: string;
|
132
141
|
authToken?: string;
|
package/index.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import { ConnectionOptions } from 'tls';
|
2
2
|
|
3
|
-
declare const
|
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"];
|
4
6
|
type Driver = (typeof drivers)[number];
|
5
7
|
|
6
|
-
declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
|
8
|
+
declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
|
7
9
|
type Dialect = (typeof dialects)[number];
|
8
10
|
|
9
11
|
type SslOptions = {
|
@@ -120,13 +122,20 @@ type Config = {
|
|
120
122
|
migrations?: {
|
121
123
|
table?: string;
|
122
124
|
schema?: string;
|
125
|
+
prefix?: Prefix;
|
123
126
|
};
|
124
127
|
introspect?: {
|
125
128
|
casing: 'camel' | 'preserve';
|
126
129
|
};
|
130
|
+
entities?: {
|
131
|
+
roles?: boolean | {
|
132
|
+
provider?: string;
|
133
|
+
exclude?: string[];
|
134
|
+
include?: string[];
|
135
|
+
}[];
|
136
|
+
};
|
127
137
|
} & ({
|
128
|
-
dialect: Verify<Dialect, '
|
129
|
-
driver: Verify<Driver, 'turso'>;
|
138
|
+
dialect: Verify<Dialect, 'turso'>;
|
130
139
|
dbCredentials: {
|
131
140
|
url: string;
|
132
141
|
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.24.2-d496e6f",
|
4
4
|
"homepage": "https://orm.drizzle.team",
|
5
5
|
"keywords": [
|
6
6
|
"drizzle",
|
@@ -39,7 +39,6 @@
|
|
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
41
|
"tsc": "tsc -p tsconfig.build.json",
|
42
|
-
"types": "tsc --noEmit",
|
43
42
|
"publish": "npm publish package.tgz"
|
44
43
|
},
|
45
44
|
"dependencies": {
|
@@ -52,10 +51,10 @@
|
|
52
51
|
"@arethetypeswrong/cli": "^0.15.3",
|
53
52
|
"@aws-sdk/client-rds-data": "^3.556.0",
|
54
53
|
"@cloudflare/workers-types": "^4.20230518.0",
|
55
|
-
"@electric-sql/pglite": "^0.
|
54
|
+
"@electric-sql/pglite": "^0.2.5",
|
56
55
|
"@hono/node-server": "^1.9.0",
|
57
56
|
"@hono/zod-validator": "^0.2.1",
|
58
|
-
"@libsql/client": "^0.
|
57
|
+
"@libsql/client": "^0.10.0",
|
59
58
|
"@neondatabase/serverless": "^0.9.1",
|
60
59
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
61
60
|
"@planetscale/database": "^1.16.0",
|
@@ -75,6 +74,7 @@
|
|
75
74
|
"@vercel/postgres": "^0.8.0",
|
76
75
|
"ava": "^5.1.0",
|
77
76
|
"better-sqlite3": "^9.4.3",
|
77
|
+
"bun-types": "^0.6.6",
|
78
78
|
"camelcase": "^7.0.1",
|
79
79
|
"chalk": "^5.2.0",
|
80
80
|
"commander": "^12.1.0",
|
package/utils.js
CHANGED
@@ -564,9 +564,11 @@ var require_hanji = __commonJS({
|
|
564
564
|
// src/utils.ts
|
565
565
|
var utils_exports = {};
|
566
566
|
__export(utils_exports, {
|
567
|
-
|
567
|
+
assertV1OutFolder: () => assertV1OutFolder,
|
568
568
|
columnRenameKey: () => columnRenameKey,
|
569
569
|
copy: () => copy,
|
570
|
+
dryJournal: () => dryJournal,
|
571
|
+
findAddedAndRemoved: () => findAddedAndRemoved,
|
570
572
|
isPgArrayType: () => isPgArrayType,
|
571
573
|
kloudMeta: () => kloudMeta,
|
572
574
|
normalisePGliteUrl: () => normalisePGliteUrl,
|
@@ -5145,6 +5147,12 @@ var sequenceSchema = objectType({
|
|
5145
5147
|
cycle: booleanType().optional(),
|
5146
5148
|
schema: stringType()
|
5147
5149
|
}).strict();
|
5150
|
+
var roleSchema = objectType({
|
5151
|
+
name: stringType(),
|
5152
|
+
createDb: booleanType().optional(),
|
5153
|
+
createRole: booleanType().optional(),
|
5154
|
+
inherit: booleanType().optional()
|
5155
|
+
}).strict();
|
5148
5156
|
var sequenceSquashed = objectType({
|
5149
5157
|
name: stringType(),
|
5150
5158
|
schema: stringType(),
|
@@ -5208,6 +5216,14 @@ var uniqueConstraint2 = objectType({
|
|
5208
5216
|
columns: stringType().array(),
|
5209
5217
|
nullsNotDistinct: booleanType()
|
5210
5218
|
}).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();
|
5211
5227
|
var tableV42 = objectType({
|
5212
5228
|
name: stringType(),
|
5213
5229
|
schema: stringType(),
|
@@ -5249,7 +5265,8 @@ var table2 = objectType({
|
|
5249
5265
|
indexes: recordType(stringType(), index2),
|
5250
5266
|
foreignKeys: recordType(stringType(), fk2),
|
5251
5267
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5252
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5268
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
|
5269
|
+
policies: recordType(stringType(), policy).default({})
|
5253
5270
|
}).strict();
|
5254
5271
|
var schemaHash2 = objectType({
|
5255
5272
|
id: stringType(),
|
@@ -5343,6 +5360,7 @@ var pgSchemaInternal = objectType({
|
|
5343
5360
|
enums: recordType(stringType(), enumSchema),
|
5344
5361
|
schemas: recordType(stringType(), stringType()),
|
5345
5362
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
5363
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5346
5364
|
_meta: objectType({
|
5347
5365
|
schemas: recordType(stringType(), stringType()),
|
5348
5366
|
tables: recordType(stringType(), stringType()),
|
@@ -5357,7 +5375,8 @@ var tableSquashed2 = objectType({
|
|
5357
5375
|
indexes: recordType(stringType(), stringType()),
|
5358
5376
|
foreignKeys: recordType(stringType(), stringType()),
|
5359
5377
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5360
|
-
uniqueConstraints: recordType(stringType(), stringType())
|
5378
|
+
uniqueConstraints: recordType(stringType(), stringType()),
|
5379
|
+
policies: recordType(stringType(), stringType())
|
5361
5380
|
}).strict();
|
5362
5381
|
var tableSquashedV42 = objectType({
|
5363
5382
|
name: stringType(),
|
@@ -5386,7 +5405,8 @@ var pgSchemaSquashed = objectType({
|
|
5386
5405
|
tables: recordType(stringType(), tableSquashed2),
|
5387
5406
|
enums: recordType(stringType(), enumSchema),
|
5388
5407
|
schemas: recordType(stringType(), stringType()),
|
5389
|
-
sequences: recordType(stringType(), sequenceSquashed)
|
5408
|
+
sequences: recordType(stringType(), sequenceSquashed),
|
5409
|
+
roles: recordType(stringType(), roleSchema).default({})
|
5390
5410
|
}).strict();
|
5391
5411
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5392
5412
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -5555,25 +5575,39 @@ var copy = (it) => {
|
|
5555
5575
|
var objectValues = (obj) => {
|
5556
5576
|
return Object.values(obj);
|
5557
5577
|
};
|
5558
|
-
var
|
5578
|
+
var assertV1OutFolder = (out) => {
|
5559
5579
|
if (!(0, import_fs.existsSync)(out))
|
5560
5580
|
return;
|
5561
|
-
|
5562
|
-
|
5563
|
-
console.log(
|
5564
|
-
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5565
|
-
`drizzle-kit up`
|
5566
|
-
)}`
|
5581
|
+
const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
|
5582
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
5567
5583
|
);
|
5568
|
-
|
5584
|
+
if (oldMigrationFolders.length > 0) {
|
5585
|
+
console.log(
|
5586
|
+
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5587
|
+
`drizzle-kit up`
|
5588
|
+
)}`
|
5589
|
+
);
|
5590
|
+
process.exit(1);
|
5591
|
+
}
|
5592
|
+
};
|
5593
|
+
var dryJournal = (dialect3) => {
|
5594
|
+
return {
|
5595
|
+
version: snapshotVersion,
|
5596
|
+
dialect: dialect3,
|
5597
|
+
entries: []
|
5598
|
+
};
|
5569
5599
|
};
|
5570
5600
|
var prepareOutFolder = (out, dialect3) => {
|
5571
|
-
(0,
|
5572
|
-
const
|
5573
|
-
|
5574
|
-
|
5601
|
+
const meta = (0, import_path.join)(out, "meta");
|
5602
|
+
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
5603
|
+
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
5604
|
+
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
5605
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect3)));
|
5606
|
+
}
|
5607
|
+
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
5608
|
+
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
5575
5609
|
snapshots.sort();
|
5576
|
-
return snapshots;
|
5610
|
+
return { meta, snapshots, journal };
|
5577
5611
|
};
|
5578
5612
|
var validatorForDialect = (dialect3) => {
|
5579
5613
|
switch (dialect3) {
|
@@ -5581,6 +5615,8 @@ var validatorForDialect = (dialect3) => {
|
|
5581
5615
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
5582
5616
|
case "sqlite":
|
5583
5617
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5618
|
+
case "turso":
|
5619
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5584
5620
|
case "mysql":
|
5585
5621
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
5586
5622
|
}
|
@@ -5628,7 +5664,7 @@ var validateWithReport = (snapshots, dialect3) => {
|
|
5628
5664
|
return result;
|
5629
5665
|
};
|
5630
5666
|
var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
5631
|
-
const snapshots = prepareOutFolder(outFolder, dialect3);
|
5667
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect3);
|
5632
5668
|
const report = validateWithReport(snapshots, dialect3);
|
5633
5669
|
if (report.nonLatest.length > 0) {
|
5634
5670
|
console.log(
|
@@ -5660,7 +5696,7 @@ var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
|
5660
5696
|
if (abort) {
|
5661
5697
|
process.exit(0);
|
5662
5698
|
}
|
5663
|
-
return snapshots;
|
5699
|
+
return { snapshots, journal };
|
5664
5700
|
};
|
5665
5701
|
var prepareMigrationMeta = (schemas, tables, columns) => {
|
5666
5702
|
const _meta = {
|
@@ -5735,11 +5771,20 @@ var normalisePGliteUrl = (it) => {
|
|
5735
5771
|
function isPgArrayType(sqlType) {
|
5736
5772
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5737
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
|
+
}
|
5738
5781
|
// Annotate the CommonJS export names for ESM import in node:
|
5739
5782
|
0 && (module.exports = {
|
5740
|
-
|
5783
|
+
assertV1OutFolder,
|
5741
5784
|
columnRenameKey,
|
5742
5785
|
copy,
|
5786
|
+
dryJournal,
|
5787
|
+
findAddedAndRemoved,
|
5743
5788
|
isPgArrayType,
|
5744
5789
|
kloudMeta,
|
5745
5790
|
normalisePGliteUrl,
|
package/utils.mjs
CHANGED
@@ -1052,7 +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 { existsSync,
|
1055
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
|
1056
1056
|
import { join } from "path";
|
1057
1057
|
import { parse } from "url";
|
1058
1058
|
|
@@ -5126,6 +5126,12 @@ var sequenceSchema = objectType({
|
|
5126
5126
|
cycle: booleanType().optional(),
|
5127
5127
|
schema: stringType()
|
5128
5128
|
}).strict();
|
5129
|
+
var roleSchema = objectType({
|
5130
|
+
name: stringType(),
|
5131
|
+
createDb: booleanType().optional(),
|
5132
|
+
createRole: booleanType().optional(),
|
5133
|
+
inherit: booleanType().optional()
|
5134
|
+
}).strict();
|
5129
5135
|
var sequenceSquashed = objectType({
|
5130
5136
|
name: stringType(),
|
5131
5137
|
schema: stringType(),
|
@@ -5189,6 +5195,14 @@ var uniqueConstraint2 = objectType({
|
|
5189
5195
|
columns: stringType().array(),
|
5190
5196
|
nullsNotDistinct: booleanType()
|
5191
5197
|
}).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();
|
5192
5206
|
var tableV42 = objectType({
|
5193
5207
|
name: stringType(),
|
5194
5208
|
schema: stringType(),
|
@@ -5230,7 +5244,8 @@ var table2 = objectType({
|
|
5230
5244
|
indexes: recordType(stringType(), index2),
|
5231
5245
|
foreignKeys: recordType(stringType(), fk2),
|
5232
5246
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5233
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5247
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
|
5248
|
+
policies: recordType(stringType(), policy).default({})
|
5234
5249
|
}).strict();
|
5235
5250
|
var schemaHash2 = objectType({
|
5236
5251
|
id: stringType(),
|
@@ -5324,6 +5339,7 @@ var pgSchemaInternal = objectType({
|
|
5324
5339
|
enums: recordType(stringType(), enumSchema),
|
5325
5340
|
schemas: recordType(stringType(), stringType()),
|
5326
5341
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
5342
|
+
roles: recordType(stringType(), roleSchema).default({}),
|
5327
5343
|
_meta: objectType({
|
5328
5344
|
schemas: recordType(stringType(), stringType()),
|
5329
5345
|
tables: recordType(stringType(), stringType()),
|
@@ -5338,7 +5354,8 @@ var tableSquashed2 = objectType({
|
|
5338
5354
|
indexes: recordType(stringType(), stringType()),
|
5339
5355
|
foreignKeys: recordType(stringType(), stringType()),
|
5340
5356
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5341
|
-
uniqueConstraints: recordType(stringType(), stringType())
|
5357
|
+
uniqueConstraints: recordType(stringType(), stringType()),
|
5358
|
+
policies: recordType(stringType(), stringType())
|
5342
5359
|
}).strict();
|
5343
5360
|
var tableSquashedV42 = objectType({
|
5344
5361
|
name: stringType(),
|
@@ -5367,7 +5384,8 @@ var pgSchemaSquashed = objectType({
|
|
5367
5384
|
tables: recordType(stringType(), tableSquashed2),
|
5368
5385
|
enums: recordType(stringType(), enumSchema),
|
5369
5386
|
schemas: recordType(stringType(), stringType()),
|
5370
|
-
sequences: recordType(stringType(), sequenceSquashed)
|
5387
|
+
sequences: recordType(stringType(), sequenceSquashed),
|
5388
|
+
roles: recordType(stringType(), roleSchema).default({})
|
5371
5389
|
}).strict();
|
5372
5390
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5373
5391
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -5536,25 +5554,39 @@ var copy = (it) => {
|
|
5536
5554
|
var objectValues = (obj) => {
|
5537
5555
|
return Object.values(obj);
|
5538
5556
|
};
|
5539
|
-
var
|
5557
|
+
var assertV1OutFolder = (out) => {
|
5540
5558
|
if (!existsSync(out))
|
5541
5559
|
return;
|
5542
|
-
|
5543
|
-
|
5544
|
-
console.log(
|
5545
|
-
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5546
|
-
`drizzle-kit up`
|
5547
|
-
)}`
|
5560
|
+
const oldMigrationFolders = readdirSync(out).filter(
|
5561
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
5548
5562
|
);
|
5549
|
-
|
5563
|
+
if (oldMigrationFolders.length > 0) {
|
5564
|
+
console.log(
|
5565
|
+
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5566
|
+
`drizzle-kit up`
|
5567
|
+
)}`
|
5568
|
+
);
|
5569
|
+
process.exit(1);
|
5570
|
+
}
|
5571
|
+
};
|
5572
|
+
var dryJournal = (dialect3) => {
|
5573
|
+
return {
|
5574
|
+
version: snapshotVersion,
|
5575
|
+
dialect: dialect3,
|
5576
|
+
entries: []
|
5577
|
+
};
|
5550
5578
|
};
|
5551
5579
|
var prepareOutFolder = (out, dialect3) => {
|
5552
|
-
|
5553
|
-
const
|
5554
|
-
|
5555
|
-
|
5580
|
+
const meta = join(out, "meta");
|
5581
|
+
const journalPath = join(meta, "_journal.json");
|
5582
|
+
if (!existsSync(join(out, "meta"))) {
|
5583
|
+
mkdirSync(meta, { recursive: true });
|
5584
|
+
writeFileSync(journalPath, JSON.stringify(dryJournal(dialect3)));
|
5585
|
+
}
|
5586
|
+
const journal = JSON.parse(readFileSync(journalPath).toString());
|
5587
|
+
const snapshots = readdirSync(meta).filter((it) => !it.startsWith("_")).map((it) => join(meta, it));
|
5556
5588
|
snapshots.sort();
|
5557
|
-
return snapshots;
|
5589
|
+
return { meta, snapshots, journal };
|
5558
5590
|
};
|
5559
5591
|
var validatorForDialect = (dialect3) => {
|
5560
5592
|
switch (dialect3) {
|
@@ -5562,6 +5594,8 @@ var validatorForDialect = (dialect3) => {
|
|
5562
5594
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
5563
5595
|
case "sqlite":
|
5564
5596
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5597
|
+
case "turso":
|
5598
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5565
5599
|
case "mysql":
|
5566
5600
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
5567
5601
|
}
|
@@ -5609,7 +5643,7 @@ var validateWithReport = (snapshots, dialect3) => {
|
|
5609
5643
|
return result;
|
5610
5644
|
};
|
5611
5645
|
var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
5612
|
-
const snapshots = prepareOutFolder(outFolder, dialect3);
|
5646
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect3);
|
5613
5647
|
const report = validateWithReport(snapshots, dialect3);
|
5614
5648
|
if (report.nonLatest.length > 0) {
|
5615
5649
|
console.log(
|
@@ -5641,7 +5675,7 @@ var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
|
5641
5675
|
if (abort) {
|
5642
5676
|
process.exit(0);
|
5643
5677
|
}
|
5644
|
-
return snapshots;
|
5678
|
+
return { snapshots, journal };
|
5645
5679
|
};
|
5646
5680
|
var prepareMigrationMeta = (schemas, tables, columns) => {
|
5647
5681
|
const _meta = {
|
@@ -5716,10 +5750,19 @@ var normalisePGliteUrl = (it) => {
|
|
5716
5750
|
function isPgArrayType(sqlType) {
|
5717
5751
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5718
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
|
+
}
|
5719
5760
|
export {
|
5720
|
-
|
5761
|
+
assertV1OutFolder,
|
5721
5762
|
columnRenameKey,
|
5722
5763
|
copy,
|
5764
|
+
dryJournal,
|
5765
|
+
findAddedAndRemoved,
|
5723
5766
|
isPgArrayType,
|
5724
5767
|
kloudMeta,
|
5725
5768
|
normalisePGliteUrl,
|