drizzle-kit 0.24.2-87df7e9 → 0.24.2-8cf7a61
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +6 -6
- package/api.d.ts +6 -6
- package/api.js +89124 -14604
- package/api.mjs +89121 -14604
- package/bin.cjs +65706 -64363
- package/index.d.mts +6 -4
- package/index.d.ts +6 -4
- package/package.json +3 -3
- package/utils.js +44 -17
- package/utils.mjs +42 -17
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,13 @@ 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
|
};
|
127
130
|
} & ({
|
128
|
-
dialect: Verify<Dialect, '
|
129
|
-
driver: Verify<Driver, 'turso'>;
|
131
|
+
dialect: Verify<Dialect, 'turso'>;
|
130
132
|
dbCredentials: {
|
131
133
|
url: string;
|
132
134
|
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,13 @@ 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
|
};
|
127
130
|
} & ({
|
128
|
-
dialect: Verify<Dialect, '
|
129
|
-
driver: Verify<Driver, 'turso'>;
|
131
|
+
dialect: Verify<Dialect, 'turso'>;
|
130
132
|
dbCredentials: {
|
131
133
|
url: string;
|
132
134
|
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-8cf7a61",
|
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": {
|
@@ -55,7 +54,7 @@
|
|
55
54
|
"@electric-sql/pglite": "^0.1.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,
|
@@ -5555,25 +5557,39 @@ var copy = (it) => {
|
|
5555
5557
|
var objectValues = (obj) => {
|
5556
5558
|
return Object.values(obj);
|
5557
5559
|
};
|
5558
|
-
var
|
5560
|
+
var assertV1OutFolder = (out) => {
|
5559
5561
|
if (!(0, import_fs.existsSync)(out))
|
5560
5562
|
return;
|
5561
|
-
|
5562
|
-
|
5563
|
-
console.log(
|
5564
|
-
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5565
|
-
`drizzle-kit up`
|
5566
|
-
)}`
|
5563
|
+
const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
|
5564
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
5567
5565
|
);
|
5568
|
-
|
5566
|
+
if (oldMigrationFolders.length > 0) {
|
5567
|
+
console.log(
|
5568
|
+
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5569
|
+
`drizzle-kit up`
|
5570
|
+
)}`
|
5571
|
+
);
|
5572
|
+
process.exit(1);
|
5573
|
+
}
|
5574
|
+
};
|
5575
|
+
var dryJournal = (dialect3) => {
|
5576
|
+
return {
|
5577
|
+
version: snapshotVersion,
|
5578
|
+
dialect: dialect3,
|
5579
|
+
entries: []
|
5580
|
+
};
|
5569
5581
|
};
|
5570
5582
|
var prepareOutFolder = (out, dialect3) => {
|
5571
|
-
(0,
|
5572
|
-
const
|
5573
|
-
|
5574
|
-
|
5583
|
+
const meta = (0, import_path.join)(out, "meta");
|
5584
|
+
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
5585
|
+
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
5586
|
+
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
5587
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect3)));
|
5588
|
+
}
|
5589
|
+
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
5590
|
+
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
5575
5591
|
snapshots.sort();
|
5576
|
-
return snapshots;
|
5592
|
+
return { meta, snapshots, journal };
|
5577
5593
|
};
|
5578
5594
|
var validatorForDialect = (dialect3) => {
|
5579
5595
|
switch (dialect3) {
|
@@ -5581,6 +5597,8 @@ var validatorForDialect = (dialect3) => {
|
|
5581
5597
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
5582
5598
|
case "sqlite":
|
5583
5599
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5600
|
+
case "turso":
|
5601
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5584
5602
|
case "mysql":
|
5585
5603
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
5586
5604
|
}
|
@@ -5628,7 +5646,7 @@ var validateWithReport = (snapshots, dialect3) => {
|
|
5628
5646
|
return result;
|
5629
5647
|
};
|
5630
5648
|
var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
5631
|
-
const snapshots = prepareOutFolder(outFolder, dialect3);
|
5649
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect3);
|
5632
5650
|
const report = validateWithReport(snapshots, dialect3);
|
5633
5651
|
if (report.nonLatest.length > 0) {
|
5634
5652
|
console.log(
|
@@ -5660,7 +5678,7 @@ var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
|
5660
5678
|
if (abort) {
|
5661
5679
|
process.exit(0);
|
5662
5680
|
}
|
5663
|
-
return snapshots;
|
5681
|
+
return { snapshots, journal };
|
5664
5682
|
};
|
5665
5683
|
var prepareMigrationMeta = (schemas, tables, columns) => {
|
5666
5684
|
const _meta = {
|
@@ -5735,11 +5753,20 @@ var normalisePGliteUrl = (it) => {
|
|
5735
5753
|
function isPgArrayType(sqlType) {
|
5736
5754
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5737
5755
|
}
|
5756
|
+
function findAddedAndRemoved(columnNames1, columnNames2) {
|
5757
|
+
const set1 = new Set(columnNames1);
|
5758
|
+
const set2 = new Set(columnNames2);
|
5759
|
+
const addedColumns = columnNames2.filter((it) => !set1.has(it));
|
5760
|
+
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
5761
|
+
return { addedColumns, removedColumns };
|
5762
|
+
}
|
5738
5763
|
// Annotate the CommonJS export names for ESM import in node:
|
5739
5764
|
0 && (module.exports = {
|
5740
|
-
|
5765
|
+
assertV1OutFolder,
|
5741
5766
|
columnRenameKey,
|
5742
5767
|
copy,
|
5768
|
+
dryJournal,
|
5769
|
+
findAddedAndRemoved,
|
5743
5770
|
isPgArrayType,
|
5744
5771
|
kloudMeta,
|
5745
5772
|
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
|
|
@@ -5536,25 +5536,39 @@ var copy = (it) => {
|
|
5536
5536
|
var objectValues = (obj) => {
|
5537
5537
|
return Object.values(obj);
|
5538
5538
|
};
|
5539
|
-
var
|
5539
|
+
var assertV1OutFolder = (out) => {
|
5540
5540
|
if (!existsSync(out))
|
5541
5541
|
return;
|
5542
|
-
|
5543
|
-
|
5544
|
-
console.log(
|
5545
|
-
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5546
|
-
`drizzle-kit up`
|
5547
|
-
)}`
|
5542
|
+
const oldMigrationFolders = readdirSync(out).filter(
|
5543
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
5548
5544
|
);
|
5549
|
-
|
5545
|
+
if (oldMigrationFolders.length > 0) {
|
5546
|
+
console.log(
|
5547
|
+
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
5548
|
+
`drizzle-kit up`
|
5549
|
+
)}`
|
5550
|
+
);
|
5551
|
+
process.exit(1);
|
5552
|
+
}
|
5553
|
+
};
|
5554
|
+
var dryJournal = (dialect3) => {
|
5555
|
+
return {
|
5556
|
+
version: snapshotVersion,
|
5557
|
+
dialect: dialect3,
|
5558
|
+
entries: []
|
5559
|
+
};
|
5550
5560
|
};
|
5551
5561
|
var prepareOutFolder = (out, dialect3) => {
|
5552
|
-
|
5553
|
-
const
|
5554
|
-
|
5555
|
-
|
5562
|
+
const meta = join(out, "meta");
|
5563
|
+
const journalPath = join(meta, "_journal.json");
|
5564
|
+
if (!existsSync(join(out, "meta"))) {
|
5565
|
+
mkdirSync(meta, { recursive: true });
|
5566
|
+
writeFileSync(journalPath, JSON.stringify(dryJournal(dialect3)));
|
5567
|
+
}
|
5568
|
+
const journal = JSON.parse(readFileSync(journalPath).toString());
|
5569
|
+
const snapshots = readdirSync(meta).filter((it) => !it.startsWith("_")).map((it) => join(meta, it));
|
5556
5570
|
snapshots.sort();
|
5557
|
-
return snapshots;
|
5571
|
+
return { meta, snapshots, journal };
|
5558
5572
|
};
|
5559
5573
|
var validatorForDialect = (dialect3) => {
|
5560
5574
|
switch (dialect3) {
|
@@ -5562,6 +5576,8 @@ var validatorForDialect = (dialect3) => {
|
|
5562
5576
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
5563
5577
|
case "sqlite":
|
5564
5578
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5579
|
+
case "turso":
|
5580
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5565
5581
|
case "mysql":
|
5566
5582
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
5567
5583
|
}
|
@@ -5609,7 +5625,7 @@ var validateWithReport = (snapshots, dialect3) => {
|
|
5609
5625
|
return result;
|
5610
5626
|
};
|
5611
5627
|
var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
5612
|
-
const snapshots = prepareOutFolder(outFolder, dialect3);
|
5628
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect3);
|
5613
5629
|
const report = validateWithReport(snapshots, dialect3);
|
5614
5630
|
if (report.nonLatest.length > 0) {
|
5615
5631
|
console.log(
|
@@ -5641,7 +5657,7 @@ var prepareMigrationFolder = (outFolder = "drizzle", dialect3) => {
|
|
5641
5657
|
if (abort) {
|
5642
5658
|
process.exit(0);
|
5643
5659
|
}
|
5644
|
-
return snapshots;
|
5660
|
+
return { snapshots, journal };
|
5645
5661
|
};
|
5646
5662
|
var prepareMigrationMeta = (schemas, tables, columns) => {
|
5647
5663
|
const _meta = {
|
@@ -5716,10 +5732,19 @@ var normalisePGliteUrl = (it) => {
|
|
5716
5732
|
function isPgArrayType(sqlType) {
|
5717
5733
|
return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
|
5718
5734
|
}
|
5735
|
+
function findAddedAndRemoved(columnNames1, columnNames2) {
|
5736
|
+
const set1 = new Set(columnNames1);
|
5737
|
+
const set2 = new Set(columnNames2);
|
5738
|
+
const addedColumns = columnNames2.filter((it) => !set1.has(it));
|
5739
|
+
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
5740
|
+
return { addedColumns, removedColumns };
|
5741
|
+
}
|
5719
5742
|
export {
|
5720
|
-
|
5743
|
+
assertV1OutFolder,
|
5721
5744
|
columnRenameKey,
|
5722
5745
|
copy,
|
5746
|
+
dryJournal,
|
5747
|
+
findAddedAndRemoved,
|
5723
5748
|
isPgArrayType,
|
5724
5749
|
kloudMeta,
|
5725
5750
|
normalisePGliteUrl,
|