drizzle-kit 0.20.14-1ebe0ff → 0.20.14-1f2c838
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +40046 -40018
- package/cli/commands/mysqlIntrospect.d.ts +119 -0
- package/cli/commands/mysqlPushUtils.d.ts +18 -0
- package/cli/commands/sqlitePushUtils.d.ts +21 -0
- package/drivers/index.d.ts +14 -0
- package/global.d.ts +1 -0
- package/introspect-mysql.d.ts +9 -0
- package/package.json +14 -2
- package/payload.d.mts +33 -0
- package/payload.d.ts +33 -0
- package/payload.js +36792 -0
- package/payload.mjs +36811 -0
- package/serializer/mysqlImports.d.ts +5 -0
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteImports.d.ts +4 -0
- package/utils.d.ts +1 -15
- package/utils.js +3626 -54861
- package/utils.mjs +8062 -0
- package/cli/utils.d.ts +0 -12
- package/cli/validations/sqlite.d.ts +0 -220
- package/cli/validations/studio.d.ts +0 -593
- package/orm-extenstions/d1-driver/driver.d.ts +0 -8
- package/orm-extenstions/d1-driver/session.d.ts +0 -51
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
- package/serializer/studioUtils.d.ts +0 -65
@@ -0,0 +1,119 @@
|
|
1
|
+
import { MySQLConfigIntrospect, MySQLConnectionConfig } from "../validations/mysql";
|
2
|
+
import { DrizzleDbClient, MySQL2Client } from "src/drivers";
|
3
|
+
export declare const connectToMySQL: (config: MySQLConnectionConfig) => Promise<{
|
4
|
+
client: MySQL2Client;
|
5
|
+
databaseName: string;
|
6
|
+
}>;
|
7
|
+
export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: string[]) => Promise<{
|
8
|
+
schema: {
|
9
|
+
id: string;
|
10
|
+
prevId: string;
|
11
|
+
version: "5";
|
12
|
+
dialect: "mysql";
|
13
|
+
tables: Record<string, {
|
14
|
+
schema?: string | undefined;
|
15
|
+
name: string;
|
16
|
+
columns: Record<string, {
|
17
|
+
default?: any;
|
18
|
+
onUpdate?: any;
|
19
|
+
autoincrement?: boolean | undefined;
|
20
|
+
name: string;
|
21
|
+
type: string;
|
22
|
+
primaryKey: boolean;
|
23
|
+
notNull: boolean;
|
24
|
+
}>;
|
25
|
+
indexes: Record<string, {
|
26
|
+
using?: "btree" | "hash" | undefined;
|
27
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
28
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
29
|
+
name: string;
|
30
|
+
columns: string[];
|
31
|
+
isUnique: boolean;
|
32
|
+
}>;
|
33
|
+
foreignKeys: Record<string, {
|
34
|
+
onUpdate?: string | undefined;
|
35
|
+
onDelete?: string | undefined;
|
36
|
+
name: string;
|
37
|
+
tableFrom: string;
|
38
|
+
columnsFrom: string[];
|
39
|
+
tableTo: string;
|
40
|
+
columnsTo: string[];
|
41
|
+
}>;
|
42
|
+
compositePrimaryKeys: Record<string, {
|
43
|
+
name: string;
|
44
|
+
columns: string[];
|
45
|
+
}>;
|
46
|
+
uniqueConstraints: Record<string, {
|
47
|
+
name: string;
|
48
|
+
columns: string[];
|
49
|
+
}>;
|
50
|
+
}>;
|
51
|
+
schemas: Record<string, string>;
|
52
|
+
_meta: {
|
53
|
+
columns: Record<string, string>;
|
54
|
+
tables: Record<string, string>;
|
55
|
+
schemas: Record<string, string>;
|
56
|
+
};
|
57
|
+
};
|
58
|
+
ts: {
|
59
|
+
file: string;
|
60
|
+
imports: string;
|
61
|
+
decalrations: string;
|
62
|
+
schemaEntry: string;
|
63
|
+
};
|
64
|
+
}>;
|
65
|
+
export declare const mysqlPushIntrospect: (connection: {
|
66
|
+
client: DrizzleDbClient;
|
67
|
+
databaseName: string;
|
68
|
+
}, filters: string[]) => Promise<{
|
69
|
+
schema: {
|
70
|
+
id: string;
|
71
|
+
prevId: string;
|
72
|
+
version: "5";
|
73
|
+
dialect: "mysql";
|
74
|
+
tables: Record<string, {
|
75
|
+
schema?: string | undefined;
|
76
|
+
name: string;
|
77
|
+
columns: Record<string, {
|
78
|
+
default?: any;
|
79
|
+
onUpdate?: any;
|
80
|
+
autoincrement?: boolean | undefined;
|
81
|
+
name: string;
|
82
|
+
type: string;
|
83
|
+
primaryKey: boolean;
|
84
|
+
notNull: boolean;
|
85
|
+
}>;
|
86
|
+
indexes: Record<string, {
|
87
|
+
using?: "btree" | "hash" | undefined;
|
88
|
+
algorithm?: "default" | "inplace" | "copy" | undefined;
|
89
|
+
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
90
|
+
name: string;
|
91
|
+
columns: string[];
|
92
|
+
isUnique: boolean;
|
93
|
+
}>;
|
94
|
+
foreignKeys: Record<string, {
|
95
|
+
onUpdate?: string | undefined;
|
96
|
+
onDelete?: string | undefined;
|
97
|
+
name: string;
|
98
|
+
tableFrom: string;
|
99
|
+
columnsFrom: string[];
|
100
|
+
tableTo: string;
|
101
|
+
columnsTo: string[];
|
102
|
+
}>;
|
103
|
+
compositePrimaryKeys: Record<string, {
|
104
|
+
name: string;
|
105
|
+
columns: string[];
|
106
|
+
}>;
|
107
|
+
uniqueConstraints: Record<string, {
|
108
|
+
name: string;
|
109
|
+
columns: string[];
|
110
|
+
}>;
|
111
|
+
}>;
|
112
|
+
schemas: Record<string, string>;
|
113
|
+
_meta: {
|
114
|
+
columns: Record<string, string>;
|
115
|
+
tables: Record<string, string>;
|
116
|
+
schemas: Record<string, string>;
|
117
|
+
};
|
118
|
+
};
|
119
|
+
}>;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { mysqlSchema } from "src/serializer/mysqlSchema";
|
4
|
+
import { TypeOf } from "zod";
|
5
|
+
export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
|
6
|
+
export declare const logSuggestionsAndReturn: ({ connection, statements, json2, }: {
|
7
|
+
statements: JsonStatement[];
|
8
|
+
connection: DrizzleDbClient;
|
9
|
+
json2: TypeOf<typeof mysqlSchema>;
|
10
|
+
}) => Promise<{
|
11
|
+
statementsToExecute: string[];
|
12
|
+
shouldAskForApprove: boolean;
|
13
|
+
infoToPrint: string[];
|
14
|
+
columnsToRemove: string[];
|
15
|
+
schemasToRemove: string[];
|
16
|
+
tablesToTruncate: string[];
|
17
|
+
tablesToRemove: string[];
|
18
|
+
}>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { DrizzleDbClient } from "src/drivers";
|
2
|
+
import { JsonStatement } from "src/jsonStatements";
|
3
|
+
import { SQLiteSchemaInternal, SQLiteSchemaSquashed } from "src/serializer/sqliteSchema";
|
4
|
+
export declare const _moveDataStatements: (tableName: string, json: SQLiteSchemaSquashed, dataLoss?: boolean) => string[];
|
5
|
+
export declare const getOldTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
6
|
+
export declare const getNewTableName: (tableName: string, meta: SQLiteSchemaInternal["_meta"]) => string;
|
7
|
+
export declare const logSuggestionsAndReturn: ({ connection, statements, json1, json2, meta, }: {
|
8
|
+
statements: JsonStatement[];
|
9
|
+
connection: DrizzleDbClient;
|
10
|
+
json1: SQLiteSchemaSquashed;
|
11
|
+
json2: SQLiteSchemaSquashed;
|
12
|
+
meta: SQLiteSchemaInternal["_meta"];
|
13
|
+
}) => Promise<{
|
14
|
+
statementsToExecute: string[];
|
15
|
+
shouldAskForApprove: boolean;
|
16
|
+
infoToPrint: string[];
|
17
|
+
columnsToRemove: string[];
|
18
|
+
schemasToRemove: string[];
|
19
|
+
tablesToTruncate: string[];
|
20
|
+
tablesToRemove: string[];
|
21
|
+
}>;
|
package/drivers/index.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import type { Client } from "@libsql/client";
|
2
|
+
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
3
|
+
import { MySql2Database } from "drizzle-orm/mysql2";
|
2
4
|
import type { PgDatabase } from "drizzle-orm/pg-core";
|
3
5
|
import type { Client as PgClient } from "pg";
|
4
6
|
export declare abstract class DrizzleDbClient<T = any> {
|
@@ -11,10 +13,22 @@ export declare class DrizzleORMPgClient extends DrizzleDbClient<PgDatabase<any>>
|
|
11
13
|
query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
|
12
14
|
run(query: string): Promise<void>;
|
13
15
|
}
|
16
|
+
export declare class DrizzleORMMySQLClient extends DrizzleDbClient<MySql2Database<any>> {
|
17
|
+
query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
|
18
|
+
run(query: string): Promise<void>;
|
19
|
+
}
|
20
|
+
export declare class DrizzleORMSQLiteClient extends DrizzleDbClient<BetterSQLite3Database<any>> {
|
21
|
+
query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
|
22
|
+
run(query: string): Promise<void>;
|
23
|
+
}
|
14
24
|
export declare class BetterSqlite extends DrizzleDbClient {
|
15
25
|
run(query: string): Promise<void>;
|
16
26
|
query(query: string): Promise<any[]>;
|
17
27
|
}
|
28
|
+
export declare class MySQL2Client extends DrizzleDbClient {
|
29
|
+
run(query: string): Promise<void>;
|
30
|
+
query(query: string): Promise<any>;
|
31
|
+
}
|
18
32
|
export declare class TursoSqlite extends DrizzleDbClient<Client> {
|
19
33
|
run(query: string): Promise<void>;
|
20
34
|
query(query: string): Promise<any[]>;
|
package/global.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
export declare const originUUID = "00000000-0000-0000-0000-000000000000";
|
2
2
|
export declare const snapshotVersion = "5";
|
3
3
|
export declare function assertUnreachable(x: never): never;
|
4
|
+
export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import "./@types/utils";
|
2
|
+
import { ConfigIntrospectCasing } from "./cli/commands/utils";
|
3
|
+
import { MySqlSchemaInternal } from "./serializer/mysqlSchema";
|
4
|
+
export declare const schemaToTypeScript: (schema: MySqlSchemaInternal, casing: ConfigIntrospectCasing["casing"]) => {
|
5
|
+
file: string;
|
6
|
+
imports: string;
|
7
|
+
decalrations: string;
|
8
|
+
schemaEntry: string;
|
9
|
+
};
|
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-1f2c838",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
|
37
37
|
"test": "ava test --timeout=60s",
|
38
38
|
"build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
|
39
|
-
"mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts",
|
39
|
+
"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",
|
40
40
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
41
41
|
"packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
42
42
|
"tsc": "tsc -p tsconfig.build.json",
|
@@ -127,6 +127,18 @@
|
|
127
127
|
},
|
128
128
|
"types": "./utils-studio.d.mts",
|
129
129
|
"default": "./utils-studio.mjs"
|
130
|
+
},
|
131
|
+
"./payload": {
|
132
|
+
"import": {
|
133
|
+
"types": "./payload.d.mts",
|
134
|
+
"default": "./payload.mjs"
|
135
|
+
},
|
136
|
+
"require": {
|
137
|
+
"types": "./payload.d.ts",
|
138
|
+
"default": "./payload.js"
|
139
|
+
},
|
140
|
+
"types": "./payload.d.mts",
|
141
|
+
"default": "./payload.mjs"
|
130
142
|
}
|
131
143
|
}
|
132
144
|
}
|
package/payload.d.mts
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
import { PgDatabase } from "drizzle-orm/pg-core";
|
2
|
+
import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
|
3
|
+
import { SQLiteSchema as SQLiteSchemaKit } from "./serializer/sqliteSchema";
|
4
|
+
import { MySqlSchema as MySQLSchemaKit } from "./serializer/mysqlSchema";
|
5
|
+
import { MySql2Database } from "drizzle-orm/mysql2";
|
6
|
+
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
7
|
+
export type DrizzleSnapshotJSON = PgSchemaKit;
|
8
|
+
export type DrizzleSQLiteSnapshotJSON = SQLiteSchemaKit;
|
9
|
+
export type DrizzleMySQLSnapshotJSON = MySQLSchemaKit;
|
10
|
+
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
11
|
+
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
12
|
+
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
13
|
+
hasDataLoss: boolean;
|
14
|
+
warnings: string[];
|
15
|
+
statementsToExecute: string[];
|
16
|
+
apply: () => Promise<void>;
|
17
|
+
}>;
|
18
|
+
export declare const generateSQLiteDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<SQLiteSchemaKit>;
|
19
|
+
export declare const generateSQLiteMigration: (prev: DrizzleSQLiteSnapshotJSON, cur: DrizzleSQLiteSnapshotJSON) => Promise<string[]>;
|
20
|
+
export declare const pushSQLiteSchema: (imports: Record<string, unknown>, db: BetterSQLite3Database<any>) => Promise<{
|
21
|
+
hasDataLoss: boolean;
|
22
|
+
warnings: string[];
|
23
|
+
statementsToExecute: string[];
|
24
|
+
apply: () => Promise<void>;
|
25
|
+
}>;
|
26
|
+
export declare const generateMySQLDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<MySQLSchemaKit>;
|
27
|
+
export declare const generateMySQLMigration: (prev: DrizzleMySQLSnapshotJSON, cur: DrizzleMySQLSnapshotJSON) => Promise<string[]>;
|
28
|
+
export declare const pushMySQLSchema: (imports: Record<string, unknown>, db: MySql2Database<any>, databaseName: string) => Promise<{
|
29
|
+
hasDataLoss: boolean;
|
30
|
+
warnings: string[];
|
31
|
+
statementsToExecute: string[];
|
32
|
+
apply: () => Promise<void>;
|
33
|
+
}>;
|
package/payload.d.ts
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
import { PgDatabase } from "drizzle-orm/pg-core";
|
2
|
+
import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
|
3
|
+
import { SQLiteSchema as SQLiteSchemaKit } from "./serializer/sqliteSchema";
|
4
|
+
import { MySqlSchema as MySQLSchemaKit } from "./serializer/mysqlSchema";
|
5
|
+
import { MySql2Database } from "drizzle-orm/mysql2";
|
6
|
+
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
7
|
+
export type DrizzleSnapshotJSON = PgSchemaKit;
|
8
|
+
export type DrizzleSQLiteSnapshotJSON = SQLiteSchemaKit;
|
9
|
+
export type DrizzleMySQLSnapshotJSON = MySQLSchemaKit;
|
10
|
+
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
11
|
+
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
12
|
+
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
13
|
+
hasDataLoss: boolean;
|
14
|
+
warnings: string[];
|
15
|
+
statementsToExecute: string[];
|
16
|
+
apply: () => Promise<void>;
|
17
|
+
}>;
|
18
|
+
export declare const generateSQLiteDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<SQLiteSchemaKit>;
|
19
|
+
export declare const generateSQLiteMigration: (prev: DrizzleSQLiteSnapshotJSON, cur: DrizzleSQLiteSnapshotJSON) => Promise<string[]>;
|
20
|
+
export declare const pushSQLiteSchema: (imports: Record<string, unknown>, db: BetterSQLite3Database<any>) => Promise<{
|
21
|
+
hasDataLoss: boolean;
|
22
|
+
warnings: string[];
|
23
|
+
statementsToExecute: string[];
|
24
|
+
apply: () => Promise<void>;
|
25
|
+
}>;
|
26
|
+
export declare const generateMySQLDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => Promise<MySQLSchemaKit>;
|
27
|
+
export declare const generateMySQLMigration: (prev: DrizzleMySQLSnapshotJSON, cur: DrizzleMySQLSnapshotJSON) => Promise<string[]>;
|
28
|
+
export declare const pushMySQLSchema: (imports: Record<string, unknown>, db: MySql2Database<any>, databaseName: string) => Promise<{
|
29
|
+
hasDataLoss: boolean;
|
30
|
+
warnings: string[];
|
31
|
+
statementsToExecute: string[];
|
32
|
+
apply: () => Promise<void>;
|
33
|
+
}>;
|