drizzle-kit 0.20.14-6ce9d1f → 0.20.14-95be75d
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +38063 -38088
- package/cli/commands/mysqlIntrospect.d.ts +3 -3
- package/cli/commands/mysqlPushUtils.d.ts +2 -2
- package/cli/commands/utils.d.ts +4 -4
- package/cli/index.d.ts +2 -2
- package/drivers/index.d.ts +0 -14
- package/global.d.ts +0 -1
- package/index.d.mts +6 -8
- package/index.d.ts +6 -8
- package/package.json +3 -15
- package/serializer/mysqlImports.d.ts +0 -5
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteImports.d.ts +0 -4
- package/utils-studio.js +1 -1
- package/utils-studio.mjs +1 -1
- package/utils.d.ts +15 -1
- package/utils.js +55054 -3632
- package/payload.d.mts +0 -33
- package/payload.d.ts +0 -33
- package/payload.js +0 -37000
- package/payload.mjs +0 -37019
- package/utils.mjs +0 -8076
@@ -1,7 +1,7 @@
|
|
1
|
+
import { Connection } from "mysql2/promise";
|
1
2
|
import { MySQLConfigIntrospect, MySQLConnectionConfig } from "../validations/mysql";
|
2
|
-
import { DrizzleDbClient, MySQL2Client } from "src/drivers";
|
3
3
|
export declare const connectToMySQL: (config: MySQLConnectionConfig) => Promise<{
|
4
|
-
client:
|
4
|
+
client: Connection;
|
5
5
|
databaseName: string;
|
6
6
|
}>;
|
7
7
|
export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: string[]) => Promise<{
|
@@ -63,7 +63,7 @@ export declare const mysqlIntrospect: (config: MySQLConfigIntrospect, filters: s
|
|
63
63
|
};
|
64
64
|
}>;
|
65
65
|
export declare const mysqlPushIntrospect: (connection: {
|
66
|
-
client:
|
66
|
+
client: Connection;
|
67
67
|
databaseName: string;
|
68
68
|
}, filters: string[]) => Promise<{
|
69
69
|
schema: {
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { Connection } from "mysql2/promise";
|
2
2
|
import { JsonStatement } from "../../jsonStatements";
|
3
3
|
import { mysqlSchema } from "../../serializer/mysqlSchema";
|
4
4
|
import { TypeOf } from "zod";
|
5
5
|
export declare const filterStatements: (statements: JsonStatement[], currentSchema: TypeOf<typeof mysqlSchema>, prevSchema: TypeOf<typeof mysqlSchema>) => JsonStatement[];
|
6
6
|
export declare const logSuggestionsAndReturn: ({ connection, statements, json2, }: {
|
7
7
|
statements: JsonStatement[];
|
8
|
-
connection:
|
8
|
+
connection: Connection;
|
9
9
|
json2: TypeOf<typeof mysqlSchema>;
|
10
10
|
}) => Promise<{
|
11
11
|
statementsToExecute: string[];
|
package/cli/commands/utils.d.ts
CHANGED
@@ -40,14 +40,14 @@ export declare const configCommonSchema: import("zod").ZodObject<{
|
|
40
40
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
41
41
|
}, "strip", import("zod").ZodTypeAny, {
|
42
42
|
out?: string | undefined;
|
43
|
-
driver?: "
|
43
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
44
44
|
tablesFilter?: string | string[] | undefined;
|
45
45
|
schema: string | string[];
|
46
46
|
breakpoints: boolean;
|
47
47
|
schemaFilter: string | string[];
|
48
48
|
}, {
|
49
49
|
out?: string | undefined;
|
50
|
-
driver?: "
|
50
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
51
51
|
breakpoints?: boolean | undefined;
|
52
52
|
tablesFilter?: string | string[] | undefined;
|
53
53
|
schemaFilter?: string | string[] | undefined;
|
@@ -183,14 +183,14 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
183
183
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
184
184
|
}, "strip", import("zod").ZodTypeAny, {
|
185
185
|
out?: string | undefined;
|
186
|
-
driver?: "
|
186
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
187
187
|
tablesFilter?: string | string[] | undefined;
|
188
188
|
schema: string | string[];
|
189
189
|
breakpoints: boolean;
|
190
190
|
schemaFilter: string | string[];
|
191
191
|
}, {
|
192
192
|
out?: string | undefined;
|
193
|
-
driver?: "
|
193
|
+
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
194
194
|
breakpoints?: boolean | undefined;
|
195
195
|
tablesFilter?: string | string[] | undefined;
|
196
196
|
schemaFilter?: string | string[] | undefined;
|
package/cli/index.d.ts
CHANGED
@@ -32,7 +32,7 @@ declare const cliParamsPush: import("zod").ZodObject<{
|
|
32
32
|
connectionString?: string | undefined;
|
33
33
|
uri?: string | undefined;
|
34
34
|
strict: boolean;
|
35
|
-
dialect: "
|
35
|
+
dialect: "pg" | "mysql" | "sqlite";
|
36
36
|
driver: string;
|
37
37
|
verbose: boolean;
|
38
38
|
}, {
|
@@ -50,7 +50,7 @@ declare const cliParamsPush: import("zod").ZodObject<{
|
|
50
50
|
ssl?: string | undefined;
|
51
51
|
connectionString?: string | undefined;
|
52
52
|
uri?: string | undefined;
|
53
|
-
dialect: "
|
53
|
+
dialect: "pg" | "mysql" | "sqlite";
|
54
54
|
driver: string;
|
55
55
|
}>;
|
56
56
|
export type CliParamsPush = TypeOf<typeof cliParamsPush>;
|
package/drivers/index.d.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
import type { Client } from "@libsql/client";
|
2
|
-
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
3
|
-
import { MySql2Database } from "drizzle-orm/mysql2";
|
4
2
|
import type { PgDatabase } from "drizzle-orm/pg-core";
|
5
3
|
import type { Client as PgClient } from "pg";
|
6
4
|
export declare abstract class DrizzleDbClient<T = any> {
|
@@ -13,22 +11,10 @@ export declare class DrizzleORMPgClient extends DrizzleDbClient<PgDatabase<any>>
|
|
13
11
|
query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
|
14
12
|
run(query: string): Promise<void>;
|
15
13
|
}
|
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
|
-
}
|
24
14
|
export declare class BetterSqlite extends DrizzleDbClient {
|
25
15
|
run(query: string): Promise<void>;
|
26
16
|
query(query: string): Promise<any[]>;
|
27
17
|
}
|
28
|
-
export declare class MySQL2Client extends DrizzleDbClient {
|
29
|
-
run(query: string): Promise<void>;
|
30
|
-
query(query: string): Promise<any>;
|
31
|
-
}
|
32
18
|
export declare class TursoSqlite extends DrizzleDbClient<Client> {
|
33
19
|
run(query: string): Promise<void>;
|
34
20
|
query(query: string): Promise<any[]>;
|
package/global.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
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>;
|
package/index.d.mts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Dialect } from "./schemaValidator";
|
2
1
|
export type DbConnection = {
|
3
2
|
driver: "turso";
|
4
3
|
dbCredentials: {
|
@@ -46,14 +45,13 @@ export type DbConnection = {
|
|
46
45
|
};
|
47
46
|
};
|
48
47
|
export type Config = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
schemaFilter?: string | string[];
|
48
|
+
out?: string | undefined;
|
49
|
+
breakpoints?: boolean | undefined;
|
50
|
+
tablesFilter?: string | string[] | undefined;
|
51
|
+
schemaFilter?: string | string[] | undefined;
|
54
52
|
schema?: string | string[];
|
55
|
-
verbose?: boolean;
|
56
|
-
strict?: boolean;
|
53
|
+
verbose?: boolean | undefined;
|
54
|
+
strict?: boolean | undefined;
|
57
55
|
} & {
|
58
56
|
introspect?: {
|
59
57
|
casing: "camel" | "preserve";
|
package/index.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Dialect } from "./schemaValidator";
|
2
1
|
export type DbConnection = {
|
3
2
|
driver: "turso";
|
4
3
|
dbCredentials: {
|
@@ -46,14 +45,13 @@ export type DbConnection = {
|
|
46
45
|
};
|
47
46
|
};
|
48
47
|
export type Config = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
schemaFilter?: string | string[];
|
48
|
+
out?: string | undefined;
|
49
|
+
breakpoints?: boolean | undefined;
|
50
|
+
tablesFilter?: string | string[] | undefined;
|
51
|
+
schemaFilter?: string | string[] | undefined;
|
54
52
|
schema?: string | string[];
|
55
|
-
verbose?: boolean;
|
56
|
-
strict?: boolean;
|
53
|
+
verbose?: boolean | undefined;
|
54
|
+
strict?: boolean | undefined;
|
57
55
|
} & {
|
58
56
|
introspect?: {
|
59
57
|
casing: "camel" | "preserve";
|
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-95be75d",
|
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",
|
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",
|
@@ -73,7 +73,7 @@
|
|
73
73
|
},
|
74
74
|
"devDependencies": {
|
75
75
|
"@cloudflare/workers-types": "^4.20230518.0",
|
76
|
-
"@libsql/client": "^0.
|
76
|
+
"@libsql/client": "^0.1.6",
|
77
77
|
"@types/better-sqlite3": "^7.6.4",
|
78
78
|
"@types/dockerode": "^3.3.14",
|
79
79
|
"@types/glob": "^8.1.0",
|
@@ -128,18 +128,6 @@
|
|
128
128
|
},
|
129
129
|
"types": "./utils-studio.d.mts",
|
130
130
|
"default": "./utils-studio.mjs"
|
131
|
-
},
|
132
|
-
"./payload": {
|
133
|
-
"import": {
|
134
|
-
"types": "./payload.d.mts",
|
135
|
-
"default": "./payload.mjs"
|
136
|
-
},
|
137
|
-
"require": {
|
138
|
-
"types": "./payload.d.ts",
|
139
|
-
"default": "./payload.js"
|
140
|
-
},
|
141
|
-
"types": "./payload.d.mts",
|
142
|
-
"default": "./payload.mjs"
|
143
131
|
}
|
144
132
|
}
|
145
133
|
}
|
@@ -1,9 +1,4 @@
|
|
1
1
|
import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
|
2
|
-
export declare const prepareFromExports: (exports: Record<string, unknown>) => {
|
3
|
-
tables: AnyMySqlTable<{}>[];
|
4
|
-
enums: any[];
|
5
|
-
schemas: MySqlSchema<string>[];
|
6
|
-
};
|
7
2
|
export declare const prepareFromMySqlImports: (imports: string[]) => Promise<{
|
8
3
|
tables: AnyMySqlTable<{}>[];
|
9
4
|
enums: any[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
|
2
2
|
import { MySqlSchemaInternal } from "../serializer/mysqlSchema";
|
3
|
+
import { Connection } from "mysql2/promise";
|
3
4
|
import { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
|
-
import { DrizzleDbClient } from "src/drivers";
|
5
5
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
6
6
|
export declare const generateMySqlSnapshot: (tables: AnyMySqlTable[], enums: any[], mysqlSchemas: MySqlSchema[]) => MySqlSchemaInternal;
|
7
|
-
export declare const fromDatabase: (db:
|
7
|
+
export declare const fromDatabase: (db: Connection, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
|
@@ -1,8 +1,4 @@
|
|
1
1
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
2
|
-
export declare const prepareFromExports: (exports: Record<string, unknown>) => {
|
3
|
-
tables: AnySQLiteTable<{}>[];
|
4
|
-
enums: any[];
|
5
|
-
};
|
6
2
|
export declare const prepareFromSqliteImports: (imports: string[]) => Promise<{
|
7
3
|
tables: AnySQLiteTable<{}>[];
|
8
4
|
enums: any[];
|
package/utils-studio.js
CHANGED
@@ -1639,7 +1639,7 @@ var init_pgSerializer = __esm({
|
|
1639
1639
|
END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
|
1640
1640
|
FROM pg_attribute a
|
1641
1641
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1642
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1642
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1643
1643
|
AND a.attnum > 0
|
1644
1644
|
AND NOT a.attisdropped
|
1645
1645
|
ORDER BY a.attnum;`
|
package/utils-studio.mjs
CHANGED
@@ -1648,7 +1648,7 @@ var init_pgSerializer = __esm({
|
|
1648
1648
|
END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
|
1649
1649
|
FROM pg_attribute a
|
1650
1650
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1651
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1651
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1652
1652
|
AND a.attnum > 0
|
1653
1653
|
AND NOT a.attisdropped
|
1654
1654
|
ORDER BY a.attnum;`
|
package/utils.d.ts
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import { Dialect } from "./schemaValidator";
|
2
2
|
import { NamedWithSchema } from "./cli/commands/migrate";
|
3
|
+
import { PgDatabase } from "drizzle-orm/pg-core";
|
4
|
+
import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
|
5
|
+
import { DbConnection } from ".";
|
3
6
|
export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
|
4
7
|
export type Journal = {
|
5
8
|
version: string;
|
@@ -19,6 +22,7 @@ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
|
|
19
22
|
snapshots: string[];
|
20
23
|
journal: any;
|
21
24
|
};
|
25
|
+
export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
|
22
26
|
export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
|
23
27
|
malformed: string[];
|
24
28
|
nonLatest: string[];
|
@@ -197,3 +201,13 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
|
|
197
201
|
columns: {};
|
198
202
|
} | undefined;
|
199
203
|
}>;
|
204
|
+
export type DrizzleSnapshotJSON = PgSchemaKit;
|
205
|
+
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
206
|
+
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
207
|
+
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
208
|
+
hasDataLoss: boolean;
|
209
|
+
warnings: string[];
|
210
|
+
statementsToExecute: string[];
|
211
|
+
apply: () => Promise<void>;
|
212
|
+
}>;
|
213
|
+
export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;
|