drizzle-kit 0.19.0 → 0.19.1
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/index.cjs +9 -9
- package/index.d.ts +0 -8
- package/package.json +1 -1
- package/readme.md +0 -153
package/index.cjs
CHANGED
|
@@ -5620,7 +5620,7 @@ var init_mysqlSerializer = __esm({
|
|
|
5620
5620
|
// : undefined,
|
|
5621
5621
|
};
|
|
5622
5622
|
if (column7.default !== void 0) {
|
|
5623
|
-
if (column7.default
|
|
5623
|
+
if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
|
|
5624
5624
|
columnToSet.default = sqlToStr(column7.default);
|
|
5625
5625
|
} else {
|
|
5626
5626
|
if (typeof column7.default === "string") {
|
|
@@ -5682,7 +5682,7 @@ var init_mysqlSerializer = __esm({
|
|
|
5682
5682
|
const columns2 = value.config.columns;
|
|
5683
5683
|
const name = value.config.name;
|
|
5684
5684
|
let indexColumns = columns2.map((it) => {
|
|
5685
|
-
if (it
|
|
5685
|
+
if ((0, import_drizzle_orm2.is)(it, import_drizzle_orm3.SQL)) {
|
|
5686
5686
|
return dialect3.sqlToQuery(it).sql;
|
|
5687
5687
|
} else {
|
|
5688
5688
|
return it.name;
|
|
@@ -6009,7 +6009,7 @@ var init_pgSerializer = __esm({
|
|
|
6009
6009
|
notNull
|
|
6010
6010
|
};
|
|
6011
6011
|
if (column7.default !== void 0) {
|
|
6012
|
-
if (column7.default
|
|
6012
|
+
if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
|
|
6013
6013
|
columnToSet.default = sqlToStr(column7.default);
|
|
6014
6014
|
} else {
|
|
6015
6015
|
if (typeof column7.default === "string") {
|
|
@@ -6072,7 +6072,7 @@ var init_pgSerializer = __esm({
|
|
|
6072
6072
|
columns2.map((it) => it.name)
|
|
6073
6073
|
);
|
|
6074
6074
|
let indexColumns = columns2.map((it) => {
|
|
6075
|
-
if (it
|
|
6075
|
+
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
|
6076
6076
|
return dialect4.sqlToQuery(it).sql;
|
|
6077
6077
|
} else {
|
|
6078
6078
|
return it.name;
|
|
@@ -6557,10 +6557,10 @@ var init_sqliteSerializer = __esm({
|
|
|
6557
6557
|
type: column7.getSQLType(),
|
|
6558
6558
|
primaryKey,
|
|
6559
6559
|
notNull,
|
|
6560
|
-
autoincrement: column7
|
|
6560
|
+
autoincrement: (0, import_drizzle_orm8.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false
|
|
6561
6561
|
};
|
|
6562
6562
|
if (column7.default !== void 0) {
|
|
6563
|
-
if (column7.default
|
|
6563
|
+
if ((0, import_drizzle_orm8.is)(column7.default, import_drizzle_orm9.SQL)) {
|
|
6564
6564
|
columnToSet.default = sqlToStr(column7.default);
|
|
6565
6565
|
} else {
|
|
6566
6566
|
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : column7.default;
|
|
@@ -6595,7 +6595,7 @@ var init_sqliteSerializer = __esm({
|
|
|
6595
6595
|
const columns2 = value.config.columns;
|
|
6596
6596
|
const name = value.config.name;
|
|
6597
6597
|
let indexColumns = columns2.map((it) => {
|
|
6598
|
-
if (it
|
|
6598
|
+
if ((0, import_drizzle_orm8.is)(it, import_drizzle_orm9.SQL)) {
|
|
6599
6599
|
return dialect5.sqlToQuery(it).sql;
|
|
6600
6600
|
} else {
|
|
6601
6601
|
return it.name;
|
|
@@ -6603,7 +6603,7 @@ var init_sqliteSerializer = __esm({
|
|
|
6603
6603
|
});
|
|
6604
6604
|
let where = void 0;
|
|
6605
6605
|
if (value.config.where !== void 0) {
|
|
6606
|
-
if (value.config.where
|
|
6606
|
+
if ((0, import_drizzle_orm8.is)(value.config.where, import_drizzle_orm9.SQL)) {
|
|
6607
6607
|
where = dialect5.sqlToQuery(value.config.where).sql;
|
|
6608
6608
|
}
|
|
6609
6609
|
}
|
|
@@ -44774,7 +44774,7 @@ init_source();
|
|
|
44774
44774
|
// package.json
|
|
44775
44775
|
var package_default = {
|
|
44776
44776
|
name: "drizzle-kit",
|
|
44777
|
-
version: "0.19.
|
|
44777
|
+
version: "0.19.1",
|
|
44778
44778
|
repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
|
|
44779
44779
|
author: "Drizzle Team",
|
|
44780
44780
|
license: "MIT",
|
package/index.d.ts
CHANGED
|
@@ -10,14 +10,6 @@ export type Config = {
|
|
|
10
10
|
casing: "camel" | "preserve";
|
|
11
11
|
};
|
|
12
12
|
} & ({
|
|
13
|
-
port?: number | undefined;
|
|
14
|
-
password?: string | undefined;
|
|
15
|
-
host: string;
|
|
16
|
-
user: string;
|
|
17
|
-
database: string;
|
|
18
|
-
} | {
|
|
19
|
-
connectionString: string;
|
|
20
|
-
} | {
|
|
21
13
|
driver: "turso";
|
|
22
14
|
dbCredentials: {
|
|
23
15
|
url: string;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -77,156 +77,3 @@ Running with CLI options
|
|
|
77
77
|
```shell
|
|
78
78
|
npm run generate
|
|
79
79
|
```
|
|
80
|
-
|
|
81
|
-
### Configuration
|
|
82
|
-
|
|
83
|
-
Instead of passing arguments to the CLI commands, you can also create a `drizzle.config.json` configuration file:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"out": "./migrations-folder",
|
|
88
|
-
"schema": "./src/db",
|
|
89
|
-
"breakpoints": false
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
* `out` - path to the output directory where migrations will be saved,
|
|
94
|
-
* `schema` - path to TypeScript schema file or folder with multiple schema files,
|
|
95
|
-
* `breakpoints` - whether to execute each statement in the migrations individually. Set to `true` if you are using SQLite or MySQL (as they don't support multiple DDL statements in a transaction).
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Upgrading to 0.17.0
|
|
100
|
-
|
|
101
|
-
Before running any new migrations `drizzle-kit` will ask you to upgrade first
|
|
102
|
-
|
|
103
|
-
Migration file structure < 0.17.0
|
|
104
|
-
|
|
105
|
-
```plaintext
|
|
106
|
-
📦 <project root>
|
|
107
|
-
└ 📂 migrations
|
|
108
|
-
└ 📂 20221207174503
|
|
109
|
-
├ 📜 migration.sql
|
|
110
|
-
├ 📜 snapshot.json
|
|
111
|
-
└ 📂 20230101104503
|
|
112
|
-
├ 📜 migration.sql
|
|
113
|
-
├ 📜 snapshot.json
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Migration file structure >= 0.17.0
|
|
117
|
-
|
|
118
|
-
```plaintext
|
|
119
|
-
📦 <project root>
|
|
120
|
-
└ 📂 migrations
|
|
121
|
-
└ 📂 meta
|
|
122
|
-
├ 📜 _journal.json
|
|
123
|
-
├ 📜 0000_snapshot.json
|
|
124
|
-
├ 📜 0001_snapshot.json
|
|
125
|
-
└ 📜 0000_icy_stranger.sql
|
|
126
|
-
└ 📜 0001_strange_avengers.sql
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
To easily migrate from previous folder structure to new you need to run `up` command in drizzle-kit. It's a great helper to upgrade your migrations to new format on each drizzle kit major update
|
|
130
|
-
|
|
131
|
-

|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## List of commands
|
|
135
|
-
|
|
136
|
-
### Generate SQL migrations based on current .ts schema
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
**`$ drizzle-kit generate:pg`** \
|
|
141
|
-
**`$ drizzle-kit generate:mysql`** \
|
|
142
|
-
**`$ drizzle-kit generate:sqlite`**
|
|
143
|
-
|
|
144
|
-
`--config` [optional default=drizzle.config.json] config file path\
|
|
145
|
-
`--schema` path to typescript schema file or folder with multiple schema files\
|
|
146
|
-
`--out` [optional default=drizzle/] migrations folder\
|
|
147
|
-
`--breakpoints` [optional default=false] whether to execute each statement in the migrations individually\
|
|
148
|
-
|
|
149
|
-
```shell
|
|
150
|
-
$ drizzle-kit generate:pg
|
|
151
|
-
## runs generate command with drizzle.config.json
|
|
152
|
-
|
|
153
|
-
$ drizzle-kit generate:pg --config=./custom.config.json
|
|
154
|
-
## runs generate command with custom.config.json
|
|
155
|
-
|
|
156
|
-
$ drizzle-kit generate:pg --schema=./src/schema.ts
|
|
157
|
-
## runs generate command and outputs results to ./drizzle
|
|
158
|
-
|
|
159
|
-
$ drizzle-kit generate:pg --schema=./src/schema.ts --out=./migrations/
|
|
160
|
-
## runs generate command and outputs results to ./migration
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
**Generate an empty SQL migration with `--custom`**
|
|
164
|
-
|
|
165
|
-
```shell
|
|
166
|
-
$ drizzle-kit generate:pg --custom
|
|
167
|
-
## runs generate command and outputs an empty migration for custom SQL
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Introspect existing database and generate typescript schema
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
**`$ drizzle-kit introspect:pg`** \
|
|
175
|
-
**`$ drizzle-kit introspect:mysql`**
|
|
176
|
-
|
|
177
|
-
```shell
|
|
178
|
-
drizzle-kit introspect:pg --out=migrations/ --connectionString=postgresql://user:pass@host:port/db_name
|
|
179
|
-
|
|
180
|
-
drizzle-kit introspect:pg --out=migrations/ --host=0.0.0.0 --port=5432 --user=postgres --password=pass --database=db_name --ssl
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-

|
|
184
|
-
|
|
185
|
-
### Update stale snapshots
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
**`$ drizzle-kit up:pg`** \
|
|
190
|
-
**`$ drizzle-kit up:mysql`** \
|
|
191
|
-
**`$ drizzle-kit up:sqlite`**
|
|
192
|
-
|
|
193
|
-
`--out` [optional] migrations folder\
|
|
194
|
-
`--config` [optional default=drizzle.config.json] config file path
|
|
195
|
-
|
|
196
|
-
```shell
|
|
197
|
-
## migrations folder is taken from drizzle.config.json
|
|
198
|
-
drizzle-kit up:mysql
|
|
199
|
-
|
|
200
|
-
drizzle-kit up:mysql --out=migrations/
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-

|
|
204
|
-
|
|
205
|
-
### Drop migration
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
**`$ drizzle-kit drop`**
|
|
210
|
-
|
|
211
|
-
`--out` [optional] migrations folder\
|
|
212
|
-
`--config` [optional default=drizzle.config.json] config file path
|
|
213
|
-
|
|
214
|
-

|
|
215
|
-
|
|
216
|
-
### Migrations collisions check
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
**`$ drizzle-kit check:pg`** \
|
|
221
|
-
**`$ drizzle-kit check:mysql`** \
|
|
222
|
-
**`$ drizzle-kit check:sqlite`**
|
|
223
|
-
|
|
224
|
-
`--out` [optional] migration folder\
|
|
225
|
-
`--config` [optional default=drizzle.config.json] config file path
|
|
226
|
-
|
|
227
|
-
```shell
|
|
228
|
-
## migrations folder is taken from drizzle.config.json
|
|
229
|
-
drizzle-kit check:pg
|
|
230
|
-
|
|
231
|
-
drizzle-kit check:pg --out=migrations/
|
|
232
|
-
```
|