drizzle-kit 0.20.14-a77266f → 0.20.14-b6f235e
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +21882 -21527
- package/cli/commands/migrate.d.ts +121 -97
- package/cli/commands/mysqlIntrospect.d.ts +8 -14
- package/cli/commands/mysqlPushUtils.d.ts +2 -2
- package/cli/commands/pgConnect.d.ts +1 -1
- package/cli/commands/pgIntrospect.d.ts +18 -11
- package/cli/commands/pgPushUtils.d.ts +2 -2
- package/cli/commands/sqliteIntrospect.d.ts +9 -9
- package/cli/commands/sqlitePushUtils.d.ts +3 -3
- package/cli/commands/utils.d.ts +15 -259
- package/cli/validations/cli.d.ts +107 -0
- package/cli/validations/common.d.ts +205 -7
- package/cli/validations/mysql.d.ts +6 -1
- package/cli/validations/pg.d.ts +6 -1
- package/cli/validations/sqlite.d.ts +382 -0
- package/cli/views.d.ts +7 -5
- package/global.d.ts +3 -1
- package/index.d.mts +8 -6
- package/index.d.ts +8 -6
- package/index.js +1 -0
- package/introspect-mysql.d.ts +1 -1
- package/introspect-pg.d.ts +5 -2
- package/introspect-sqlite.d.ts +1 -1
- package/jsonDiffer.d.ts +14 -29
- package/jsonStatements.d.ts +38 -11
- package/package.json +18 -50
- package/payload.js +8053 -8337
- package/payload.mjs +9022 -9312
- package/schemaValidator.d.ts +73 -70
- package/serializer/mysqlImports.d.ts +3 -7
- package/serializer/mysqlSchema.d.ts +1624 -493
- package/serializer/mysqlSerializer.d.ts +4 -4
- package/serializer/pgImports.d.ts +2 -2
- package/serializer/pgSchema.d.ts +1260 -801
- package/serializer/sqliteImports.d.ts +2 -4
- package/serializer/sqliteSchema.d.ts +144 -570
- package/serializer/sqliteSerializer.d.ts +3 -3
- package/snapshotsDiffer.d.ts +1908 -1050
- package/utils/words.d.ts +1 -1
- package/utils-studio.js +4147 -83
- package/utils-studio.mjs +4147 -83
- package/utils.d.ts +6 -140
- package/utils.js +3903 -7064
- package/utils.mjs +3982 -7143
- package/cli/commands/mysqlUp.d.ts +0 -4
- package/cli/commands/pgUp.d.ts +0 -4
- package/cli/commands/sqliteUtils.d.ts +0 -162
- package/cli/commands/upFolders.d.ts +0 -27
package/jsonDiffer.d.ts
CHANGED
@@ -1,25 +1,16 @@
|
|
1
1
|
export function diffForRenamedTables(pairs: any): any;
|
2
2
|
export function diffForRenamedColumn(t1: any, t2: any): any;
|
3
|
+
export function diffSchemasOrTables(left: any, right: any): {
|
4
|
+
added: any[];
|
5
|
+
deleted: any[];
|
6
|
+
};
|
7
|
+
export function diffColumns(left: any, right: any): {
|
8
|
+
[k: string]: any;
|
9
|
+
};
|
3
10
|
export function applyJsonDiff(json1: any, json2: any): {
|
4
|
-
addedTables?: undefined;
|
5
|
-
deletedTables?: undefined;
|
6
|
-
alteredTablesWithColumns?: undefined;
|
7
|
-
addedEnums?: undefined;
|
8
|
-
deletedEnums?: undefined;
|
9
|
-
alteredEnums?: undefined;
|
10
|
-
addedSchemas?: undefined;
|
11
|
-
deletedSchemas?: undefined;
|
12
|
-
} | {
|
13
|
-
addedTables: any[];
|
14
|
-
deletedTables: any[];
|
15
11
|
alteredTablesWithColumns: {
|
16
12
|
name: any;
|
17
|
-
schema:
|
18
|
-
type: string;
|
19
|
-
value: any;
|
20
|
-
};
|
21
|
-
deleted: any[];
|
22
|
-
added: any[];
|
13
|
+
schema: any;
|
23
14
|
altered: any[];
|
24
15
|
addedIndexes: {
|
25
16
|
[k: string]: any;
|
@@ -58,19 +49,13 @@ export function applyJsonDiff(json1: any, json2: any): {
|
|
58
49
|
[k: string]: any;
|
59
50
|
};
|
60
51
|
}[];
|
61
|
-
addedEnums: {
|
62
|
-
name: any;
|
63
|
-
values: any[];
|
64
|
-
}[];
|
65
|
-
deletedEnums: {
|
66
|
-
name: any;
|
67
|
-
values: any[];
|
68
|
-
}[];
|
69
52
|
alteredEnums: {
|
70
|
-
name:
|
71
|
-
|
53
|
+
name: any;
|
54
|
+
schema: any;
|
55
|
+
addedValues: {
|
56
|
+
before: any;
|
57
|
+
value: any;
|
58
|
+
}[];
|
72
59
|
deletedValues: any[];
|
73
60
|
}[];
|
74
|
-
addedSchemas: any[];
|
75
|
-
deletedSchemas: any[];
|
76
61
|
};
|
package/jsonStatements.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CommonSquashedSchema
|
1
|
+
import { CommonSquashedSchema } from "./schemaValidator";
|
2
2
|
import { MySqlSchema } from "./serializer/mysqlSchema";
|
3
3
|
import { PgSchema } from "./serializer/pgSchema";
|
4
4
|
import { AlteredColumn, Column, Table } from "./snapshotsDiffer";
|
@@ -34,12 +34,32 @@ export interface JsonRenameTableStatement {
|
|
34
34
|
export interface JsonCreateEnumStatement {
|
35
35
|
type: "create_type_enum";
|
36
36
|
name: string;
|
37
|
+
schema: string;
|
37
38
|
values: string[];
|
38
39
|
}
|
40
|
+
export interface JsonDropEnumStatement {
|
41
|
+
type: "drop_type_enum";
|
42
|
+
name: string;
|
43
|
+
schema: string;
|
44
|
+
}
|
45
|
+
export interface JsonMoveEnumStatement {
|
46
|
+
type: "move_type_enum";
|
47
|
+
name: string;
|
48
|
+
schemaFrom: string;
|
49
|
+
schemaTo: string;
|
50
|
+
}
|
51
|
+
export interface JsonRenameEnumStatement {
|
52
|
+
type: "rename_type_enum";
|
53
|
+
nameFrom: string;
|
54
|
+
nameTo: string;
|
55
|
+
schema: string;
|
56
|
+
}
|
39
57
|
export interface JsonAddValueToEnumStatement {
|
40
58
|
type: "alter_type_add_value";
|
41
59
|
name: string;
|
60
|
+
schema: string;
|
42
61
|
value: string;
|
62
|
+
before: string;
|
43
63
|
}
|
44
64
|
export interface JsonDropColumnStatement {
|
45
65
|
type: "alter_table_drop_column";
|
@@ -120,7 +140,8 @@ export interface JsonAlterCompositePK {
|
|
120
140
|
export interface JsonAlterTableSetSchema {
|
121
141
|
type: "alter_table_set_schema";
|
122
142
|
tableName: string;
|
123
|
-
|
143
|
+
schemaFrom: string;
|
144
|
+
schemaTo: string;
|
124
145
|
}
|
125
146
|
export interface JsonAlterTableRemoveFromSchema {
|
126
147
|
type: "alter_table_remove_from_schema";
|
@@ -292,14 +313,20 @@ export interface JsonRenameSchema {
|
|
292
313
|
to: string;
|
293
314
|
}
|
294
315
|
export type JsonAlterColumnStatement = JsonRenameColumnStatement | JsonAlterColumnTypeStatement | JsonAlterColumnSetDefaultStatement | JsonAlterColumnDropDefaultStatement | JsonAlterColumnSetNotNullStatement | JsonAlterColumnDropNotNullStatement | JsonAlterColumnDropOnUpdateStatement | JsonAlterColumnSetOnUpdateStatement | JsonAlterColumnDropAutoincrementStatement | JsonAlterColumnSetAutoincrementStatement | JsonAlterColumnSetPrimaryKeyStatement | JsonAlterColumnDropPrimaryKeyStatement;
|
295
|
-
export type JsonStatement = JsonAlterColumnStatement | JsonCreateTableStatement | JsonDropTableStatement | JsonRenameTableStatement | JsonCreateEnumStatement | JsonAddValueToEnumStatement | JsonDropColumnStatement | JsonAddColumnStatement | JsonCreateIndexStatement | JsonCreateReferenceStatement | JsonAlterReferenceStatement | JsonDeleteReferenceStatement | JsonDropIndexStatement | JsonReferenceStatement | JsonSqliteCreateTableStatement | JsonSqliteAddColumnStatement | JsonCreateCompositePK | JsonDeleteCompositePK | JsonAlterCompositePK | JsonCreateUniqueConstraint | JsonDeleteUniqueConstraint | JsonAlterUniqueConstraint | JsonCreateSchema | JsonDropSchema | JsonRenameSchema | JsonAlterTableSetSchema | JsonAlterTableRemoveFromSchema | JsonAlterTableSetNewSchema;
|
316
|
+
export type JsonStatement = JsonAlterColumnStatement | JsonCreateTableStatement | JsonDropTableStatement | JsonRenameTableStatement | JsonCreateEnumStatement | JsonDropEnumStatement | JsonMoveEnumStatement | JsonRenameEnumStatement | JsonAddValueToEnumStatement | JsonDropColumnStatement | JsonAddColumnStatement | JsonCreateIndexStatement | JsonCreateReferenceStatement | JsonAlterReferenceStatement | JsonDeleteReferenceStatement | JsonDropIndexStatement | JsonReferenceStatement | JsonSqliteCreateTableStatement | JsonSqliteAddColumnStatement | JsonCreateCompositePK | JsonDeleteCompositePK | JsonAlterCompositePK | JsonCreateUniqueConstraint | JsonDeleteUniqueConstraint | JsonAlterUniqueConstraint | JsonCreateSchema | JsonDropSchema | JsonRenameSchema | JsonAlterTableSetSchema | JsonAlterTableRemoveFromSchema | JsonAlterTableSetNewSchema;
|
296
317
|
export declare const preparePgCreateTableJson: (table: Table, json2: PgSchema) => JsonCreateTableStatement;
|
297
|
-
export declare const prepareMySqlCreateTableJson: (table: Table, json2:
|
318
|
+
export declare const prepareMySqlCreateTableJson: (table: Table, json2: MySqlSchema) => JsonCreateTableStatement;
|
298
319
|
export declare const prepareSQLiteCreateTable: (table: Table) => JsonSqliteCreateTableStatement;
|
299
320
|
export declare const prepareDropTableJson: (table: Table) => JsonDropTableStatement;
|
300
321
|
export declare const prepareRenameTableJson: (tableFrom: Table, tableTo: Table) => JsonRenameTableStatement;
|
301
|
-
export declare const prepareCreateEnumJson: (name: string, values: string[]) => JsonCreateEnumStatement;
|
302
|
-
export declare const prepareAddValuesToEnumJson: (name: string,
|
322
|
+
export declare const prepareCreateEnumJson: (name: string, schema: string, values: string[]) => JsonCreateEnumStatement;
|
323
|
+
export declare const prepareAddValuesToEnumJson: (name: string, schema: string, values: {
|
324
|
+
value: string;
|
325
|
+
before: string;
|
326
|
+
}[]) => JsonAddValueToEnumStatement[];
|
327
|
+
export declare const prepareDropEnumJson: (name: string, schema: string) => JsonDropEnumStatement;
|
328
|
+
export declare const prepareMoveEnumJson: (name: string, schemaFrom: string, schemaTo: string) => JsonMoveEnumStatement;
|
329
|
+
export declare const prepareRenameEnumJson: (nameFrom: string, nameTo: string, schema: string) => JsonRenameEnumStatement;
|
303
330
|
export declare const prepareCreateSchemasJson: (values: string[]) => JsonCreateSchema[];
|
304
331
|
export declare const prepareRenameSchemasJson: (values: {
|
305
332
|
from: string;
|
@@ -310,11 +337,11 @@ export declare const prepareRenameColumns: (tableName: string, schema: string, p
|
|
310
337
|
from: Column;
|
311
338
|
to: Column;
|
312
339
|
}[]) => JsonRenameColumnStatement[];
|
313
|
-
export declare const
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
340
|
+
export declare const _prepareDropColumns: (taleName: string, schema: string, columns: Column[]) => JsonDropColumnStatement[];
|
341
|
+
export declare const _prepareAddColumns: (tableName: string, schema: string, columns: Column[]) => JsonAddColumnStatement[];
|
342
|
+
export declare const prepareAlterColumnsMysql: (tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
|
343
|
+
export declare const preparePgAlterColumns: (_tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
|
344
|
+
export declare const prepareSqliteAlterColumns: (tableName: string, schema: string, columns: AlteredColumn[], json2: CommonSquashedSchema) => JsonAlterColumnStatement[];
|
318
345
|
export declare const prepareCreateIndexesJson: (tableName: string, schema: string, indexes: Record<string, string>) => JsonCreateIndexStatement[];
|
319
346
|
export declare const prepareCreateReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonCreateReferenceStatement[];
|
320
347
|
export declare const prepareDropReferencesJson: (tableName: string, schema: string, foreignKeys: Record<string, string>) => JsonDeleteReferenceStatement[];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.20.14-
|
3
|
+
"version": "0.20.14-b6f235e",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -8,56 +8,21 @@
|
|
8
8
|
"drizzle-kit": "./bin.cjs"
|
9
9
|
},
|
10
10
|
"scripts": {
|
11
|
-
"test:pg:push": "drizzle-kit push:pg",
|
12
11
|
"payload": "tsx ./dev/payload.ts",
|
13
12
|
"migrate:old": "drizzle-kit generate:mysql",
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"try1": "tsx ./src/t.ts",
|
17
|
-
"migrate:old:mysql": "drizzle-kit generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
|
18
|
-
"start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg",
|
19
|
-
"start:sqlite": "node -r esbuild-register ./src/cli/index.ts generate:sqlite",
|
20
|
-
"start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql",
|
21
|
-
"check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
|
22
|
-
"introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --config drizzle.config2.ts",
|
23
|
-
"introspect:sqlite": "node -r esbuild-register ./src/cli/index.ts introspect:sqlite --driver=sqlite",
|
24
|
-
"introspect:pg": "node -r esbuild-register ./src/cli/index.ts introspect:pg --out ./dev/introspect-pg --connectionString=postgresql://postgres@localhost:5432/introspect",
|
25
|
-
"drop": "node -r esbuild-register ./src/cli/index.ts drop",
|
26
|
-
"up:pg": "node -r esbuild-register ./src/cli/index.ts up:pg --out ./dev/migrations-pg",
|
27
|
-
"up:mysql": "node -r esbuild-register ./src/cli/index.ts up:mysql --out ./dev/migrations-mysql",
|
28
|
-
"check:equedi": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/equedi --dialect pg",
|
29
|
-
"run": "node -r esbuild-register index.ts",
|
30
|
-
"watch": "esbuild ./src/clie/index.ts --bundle --platform=node --target=node10.4 --outfile=./dist/index.js --external:esbuild --external:pg-native --sourcemap --watch",
|
31
|
-
"diff": "esbuild ./src/clie/index.ts ./dev/diff.ts",
|
32
|
-
"prepare:mysql": "node -r esbuild-register dev/mysql/index.ts",
|
33
|
-
"prepare:pg": "node -r esbuild-register dev/index.ts",
|
34
|
-
"prepare-snapshot": "node -r esbuild-register ./dev/prepare-snapshot prepare ./dev/data",
|
35
|
-
"sim": "node -r esbuild-register ./dev/simulate.ts",
|
36
|
-
"sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
|
37
|
-
"test": "ava test --timeout=60s",
|
38
|
-
"build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
|
13
|
+
"cli": "tsx ./src/cli/index.ts",
|
14
|
+
"test": "vitest",
|
39
15
|
"mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts && cp dist/payload.d.ts dist/payload.d.mts",
|
16
|
+
"build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
|
40
17
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
41
18
|
"packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
42
19
|
"tsc": "tsc -p tsconfig.build.json",
|
43
|
-
"pub": "cp package.json readme.md dist/ && cd dist && npm publish"
|
44
|
-
"studio": "tsx ./src/cli/index.ts studio --verbose --port=3000",
|
45
|
-
"studio:dev": "tsx ./src/cli/index.ts studio --verbose"
|
46
|
-
},
|
47
|
-
"ava": {
|
48
|
-
"files": [
|
49
|
-
"test/**/*.ts"
|
50
|
-
],
|
51
|
-
"extensions": {
|
52
|
-
"ts": "module"
|
53
|
-
},
|
54
|
-
"nodeArguments": [
|
55
|
-
"--loader=tsx"
|
56
|
-
]
|
20
|
+
"pub": "cp package.json readme.md dist/ && cd dist && npm publish"
|
57
21
|
},
|
58
22
|
"dependencies": {
|
59
23
|
"@drizzle-team/studio": "^0.0.39",
|
60
24
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
25
|
+
"@types/json-diff": "^1.0.3",
|
61
26
|
"camelcase": "^7.0.1",
|
62
27
|
"chalk": "^5.2.0",
|
63
28
|
"commander": "^9.4.1",
|
@@ -68,39 +33,42 @@
|
|
68
33
|
"hanji": "^0.0.5",
|
69
34
|
"json-diff": "0.9.0",
|
70
35
|
"minimatch": "^7.4.3",
|
36
|
+
"pluralize": "^8.0.0",
|
71
37
|
"semver": "^7.5.4",
|
72
38
|
"zod": "^3.20.2"
|
73
39
|
},
|
74
40
|
"devDependencies": {
|
75
41
|
"@cloudflare/workers-types": "^4.20230518.0",
|
76
42
|
"@libsql/client": "^0.4.2",
|
43
|
+
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
77
44
|
"@types/better-sqlite3": "^7.6.4",
|
78
45
|
"@types/dockerode": "^3.3.14",
|
79
46
|
"@types/glob": "^8.1.0",
|
80
47
|
"@types/minimatch": "^5.1.2",
|
81
48
|
"@types/node": "^18.11.15",
|
82
49
|
"@types/pg": "^8.10.7",
|
50
|
+
"@types/pluralize": "^0.0.33",
|
83
51
|
"@types/semver": "^7.5.5",
|
84
|
-
"@typescript-eslint/eslint-plugin": "^
|
85
|
-
"@typescript-eslint/parser": "^
|
86
|
-
"ava": "^5.1.0",
|
52
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
53
|
+
"@typescript-eslint/parser": "^7.2.0",
|
87
54
|
"better-sqlite3": "^8.4.0",
|
88
55
|
"dockerode": "^3.3.4",
|
89
56
|
"dotenv": "^16.0.3",
|
90
57
|
"drizzle-kit": "0.19.13",
|
91
|
-
"drizzle-orm": "0.
|
58
|
+
"drizzle-orm": "0.30.5-ab9feb7",
|
92
59
|
"esbuild-node-externals": "^1.9.0",
|
93
|
-
"eslint": "^8.
|
94
|
-
"eslint-config-prettier": "^
|
95
|
-
"eslint-plugin-prettier": "^
|
60
|
+
"eslint": "^8.57.0",
|
61
|
+
"eslint-config-prettier": "^9.1.0",
|
62
|
+
"eslint-plugin-prettier": "^5.1.3",
|
96
63
|
"get-port": "^6.1.2",
|
97
64
|
"mysql2": "2.3.3",
|
98
65
|
"pg": "^8.11.3",
|
99
66
|
"postgres": "^3.3.5",
|
100
67
|
"prettier": "^2.8.1",
|
101
68
|
"tsx": "^3.12.1",
|
102
|
-
"typescript": "^4.
|
103
|
-
"
|
69
|
+
"typescript": "^5.4.3",
|
70
|
+
"vite-tsconfig-paths": "^4.3.2",
|
71
|
+
"vitest": "^1.4.0",
|
104
72
|
"wrangler": "^3.22.1",
|
105
73
|
"zx": "^7.2.2"
|
106
74
|
},
|