drizzle-kit 0.27.2-96d338b → 0.28.0-2796c1d
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -7
- package/api.js +7 -3
- package/api.mjs +7 -3
- package/bin.cjs +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
## Drizzle Kit
|
2
2
|
|
3
|
-
|
3
|
+
Drizzle Kit is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
|
4
4
|
<https://github.com/drizzle-team/drizzle-kit-mirror> - is a mirror repository for issues.
|
5
5
|
|
6
6
|
## Documentation
|
7
7
|
|
8
|
-
Check the full
|
8
|
+
Check the full documentation on [the website](https://orm.drizzle.team/kit-docs/overview).
|
9
9
|
|
10
10
|
### How it works
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
Drizzle Kit traverses a schema module and generates a snapshot to compare with the previous version, if there is one.
|
13
|
+
Based on the difference, it will generate all needed SQL migrations. If there are any cases that can't be resolved automatically, such as renames, it will prompt the user for input.
|
14
14
|
|
15
|
-
For schema
|
15
|
+
For example, for this schema module:
|
16
16
|
|
17
17
|
```typescript
|
18
|
-
//
|
18
|
+
// src/db/schema.ts
|
19
19
|
|
20
20
|
import { integer, pgTable, serial, text, varchar } from "drizzle-orm/pg-core";
|
21
21
|
|
@@ -63,7 +63,7 @@ CREATE INDEX IF NOT EXISTS users_full_name_index ON users (full_name);
|
|
63
63
|
npm install -D drizzle-kit
|
64
64
|
```
|
65
65
|
|
66
|
-
Running with CLI options
|
66
|
+
Running with CLI options:
|
67
67
|
|
68
68
|
```jsonc
|
69
69
|
// package.json
|
package/api.js
CHANGED
@@ -21121,7 +21121,7 @@ var version;
|
|
21121
21121
|
var init_version = __esm({
|
21122
21122
|
"../drizzle-orm/dist/version.js"() {
|
21123
21123
|
"use strict";
|
21124
|
-
version = "0.36.
|
21124
|
+
version = "0.36.1";
|
21125
21125
|
}
|
21126
21126
|
});
|
21127
21127
|
|
@@ -21407,7 +21407,11 @@ var init_sql = __esm({
|
|
21407
21407
|
if (_config.invokeSource === "indexes") {
|
21408
21408
|
return { sql: escapeName(columnName), params: [] };
|
21409
21409
|
}
|
21410
|
-
|
21410
|
+
const schemaName = chunk.table[Table2.Symbol.Schema];
|
21411
|
+
return {
|
21412
|
+
sql: chunk.table[IsAlias] || schemaName === void 0 ? escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName),
|
21413
|
+
params: []
|
21414
|
+
};
|
21411
21415
|
}
|
21412
21416
|
if (is(chunk, View3)) {
|
21413
21417
|
const schemaName = chunk[ViewBaseConfig].schema;
|
@@ -35770,7 +35774,7 @@ var init_insert3 = __esm({
|
|
35770
35774
|
returning.push({ field: value, path: [key] });
|
35771
35775
|
}
|
35772
35776
|
}
|
35773
|
-
this.config.returning =
|
35777
|
+
this.config.returning = returning;
|
35774
35778
|
return this;
|
35775
35779
|
}
|
35776
35780
|
/** @internal */
|
package/api.mjs
CHANGED
@@ -21126,7 +21126,7 @@ var version;
|
|
21126
21126
|
var init_version = __esm({
|
21127
21127
|
"../drizzle-orm/dist/version.js"() {
|
21128
21128
|
"use strict";
|
21129
|
-
version = "0.36.
|
21129
|
+
version = "0.36.1";
|
21130
21130
|
}
|
21131
21131
|
});
|
21132
21132
|
|
@@ -21412,7 +21412,11 @@ var init_sql = __esm({
|
|
21412
21412
|
if (_config.invokeSource === "indexes") {
|
21413
21413
|
return { sql: escapeName(columnName), params: [] };
|
21414
21414
|
}
|
21415
|
-
|
21415
|
+
const schemaName = chunk.table[Table2.Symbol.Schema];
|
21416
|
+
return {
|
21417
|
+
sql: chunk.table[IsAlias] || schemaName === void 0 ? escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName),
|
21418
|
+
params: []
|
21419
|
+
};
|
21416
21420
|
}
|
21417
21421
|
if (is(chunk, View3)) {
|
21418
21422
|
const schemaName = chunk[ViewBaseConfig].schema;
|
@@ -35775,7 +35779,7 @@ var init_insert3 = __esm({
|
|
35775
35779
|
returning.push({ field: value, path: [key] });
|
35776
35780
|
}
|
35777
35781
|
}
|
35778
|
-
this.config.returning =
|
35782
|
+
this.config.returning = returning;
|
35779
35783
|
return this;
|
35780
35784
|
}
|
35781
35785
|
/** @internal */
|
package/bin.cjs
CHANGED
@@ -33614,7 +33614,7 @@ ${sql}
|
|
33614
33614
|
}
|
33615
33615
|
if (type === "custom") {
|
33616
33616
|
console.log("Prepared empty file for your custom SQL migration!");
|
33617
|
-
sql = "-- Custom SQL migration file, put
|
33617
|
+
sql = "-- Custom SQL migration file, put your code below! --";
|
33618
33618
|
}
|
33619
33619
|
journal.entries.push({
|
33620
33620
|
idx,
|
@@ -81593,12 +81593,12 @@ var init_introspect = __esm({
|
|
81593
81593
|
(0, import_hanji12.render)(
|
81594
81594
|
`[${source_default.green(
|
81595
81595
|
"\u2713"
|
81596
|
-
)}]
|
81596
|
+
)}] Your schema file is ready \u279C ${source_default.bold.underline.blue(schemaFile)} \u{1F680}`
|
81597
81597
|
);
|
81598
81598
|
(0, import_hanji12.render)(
|
81599
81599
|
`[${source_default.green(
|
81600
81600
|
"\u2713"
|
81601
|
-
)}]
|
81601
|
+
)}] Your relations file is ready \u279C ${source_default.bold.underline.blue(
|
81602
81602
|
relationsFile
|
81603
81603
|
)} \u{1F680}`
|
81604
81604
|
);
|
@@ -81676,12 +81676,12 @@ var init_introspect = __esm({
|
|
81676
81676
|
(0, import_hanji12.render)(
|
81677
81677
|
`[${source_default.green(
|
81678
81678
|
"\u2713"
|
81679
|
-
)}]
|
81679
|
+
)}] Your schema file is ready \u279C ${source_default.bold.underline.blue(schemaFile)} \u{1F680}`
|
81680
81680
|
);
|
81681
81681
|
(0, import_hanji12.render)(
|
81682
81682
|
`[${source_default.green(
|
81683
81683
|
"\u2713"
|
81684
|
-
)}]
|
81684
|
+
)}] Your relations file is ready \u279C ${source_default.bold.underline.blue(
|
81685
81685
|
relationsFile
|
81686
81686
|
)} \u{1F680}`
|
81687
81687
|
);
|
@@ -81840,12 +81840,12 @@ var init_introspect = __esm({
|
|
81840
81840
|
(0, import_hanji12.render)(
|
81841
81841
|
`[${source_default.green(
|
81842
81842
|
"\u2713"
|
81843
|
-
)}]
|
81843
|
+
)}] Your schema file is ready \u279C ${source_default.bold.underline.blue(schemaFile)} \u{1F680}`
|
81844
81844
|
);
|
81845
81845
|
(0, import_hanji12.render)(
|
81846
81846
|
`[${source_default.green(
|
81847
81847
|
"\u2713"
|
81848
|
-
)}]
|
81848
|
+
)}] Your relations file is ready \u279C ${source_default.bold.underline.blue(
|
81849
81849
|
relationsFile
|
81850
81850
|
)} \u{1F680}`
|
81851
81851
|
);
|
@@ -89049,7 +89049,7 @@ init_utils2();
|
|
89049
89049
|
var version2 = async () => {
|
89050
89050
|
const { npmVersion } = await ormCoreVersions();
|
89051
89051
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
89052
|
-
const envVersion = "0.
|
89052
|
+
const envVersion = "0.28.0-2796c1d";
|
89053
89053
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
89054
89054
|
const versions = `drizzle-kit: ${kitVersion}
|
89055
89055
|
${ormVersion}`;
|