drizzle-kit 0.20.14-5df59eb → 0.20.14-95be75d
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +38018 -38051
- package/cli/commands/mysqlIntrospect.d.ts +3 -3
- package/cli/commands/mysqlPushUtils.d.ts +2 -2
- package/drivers/index.d.ts +0 -14
- package/global.d.ts +0 -1
- 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/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/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>>;
|