drizzle-kit 0.20.14-1f2c838 → 0.20.14-22fcd3b
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +38186 -38213
- package/cli/utils.d.ts +12 -0
- package/cli/validations/sqlite.d.ts +220 -0
- package/cli/validations/studio.d.ts +593 -0
- package/drivers/index.d.ts +0 -14
- package/global.d.ts +0 -1
- package/orm-extenstions/d1-driver/driver.d.ts +8 -0
- package/orm-extenstions/d1-driver/session.d.ts +51 -0
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
- package/package.json +6 -17
- package/serializer/mysqlImports.d.ts +0 -5
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteImports.d.ts +0 -4
- package/serializer/studioUtils.d.ts +65 -0
- package/utils-studio.js +1 -1
- package/utils-studio.mjs +1 -1
- package/utils.d.ts +15 -1
- package/utils.js +54858 -3623
- package/cli/commands/mysqlIntrospect.d.ts +0 -119
- package/cli/commands/mysqlPushUtils.d.ts +0 -18
- package/cli/commands/sqlitePushUtils.d.ts +0 -21
- package/introspect-mysql.d.ts +0 -9
- package/payload.d.mts +0 -33
- package/payload.d.ts +0 -33
- package/payload.js +0 -36792
- package/payload.mjs +0 -36811
- package/utils.mjs +0 -8062
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-22fcd3b",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"scripts": {
|
11
11
|
"test:pg:push": "drizzle-kit push:pg",
|
12
12
|
"payload": "tsx ./dev/payload.ts",
|
13
|
-
"migrate:old": "drizzle-kit generate:
|
13
|
+
"migrate:old": "drizzle-kit generate:mysql",
|
14
14
|
"push": "node -r esbuild-register ./src/cli/index.ts push:mysql",
|
15
15
|
"push:sqlite": "node -r ./src/loader.mjs ./src/cli/index.ts push:sqlite",
|
16
16
|
"try1": "tsx ./src/t.ts",
|
@@ -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",
|
@@ -87,7 +87,8 @@
|
|
87
87
|
"better-sqlite3": "^8.4.0",
|
88
88
|
"dockerode": "^3.3.4",
|
89
89
|
"dotenv": "^16.0.3",
|
90
|
-
"drizzle-
|
90
|
+
"drizzle-kit": "0.19.13",
|
91
|
+
"drizzle-orm": "0.29.3",
|
91
92
|
"esbuild-node-externals": "^1.9.0",
|
92
93
|
"eslint": "^8.29.0",
|
93
94
|
"eslint-config-prettier": "^8.5.0",
|
@@ -127,18 +128,6 @@
|
|
127
128
|
},
|
128
129
|
"types": "./utils-studio.d.mts",
|
129
130
|
"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"
|
142
131
|
}
|
143
132
|
}
|
144
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 "src/serializer/mysqlSchema";
|
3
|
+
import { Connection } from "mysql2/promise";
|
3
4
|
import { IntrospectStage, IntrospectStatus } from "src/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[];
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import type { Setup } from "@drizzle-team/studio";
|
2
|
+
import { Relations } from "drizzle-orm";
|
3
|
+
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
4
|
+
import { AnyPgTable } from "drizzle-orm/pg-core";
|
5
|
+
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
6
|
+
import { MySQLConnectionConfig } from "src/cli/validations/mysql";
|
7
|
+
import { PgConnectionConfig } from "src/cli/validations/pg";
|
8
|
+
import { StudioConfigConnections, StudioSqliteConnectionConfig as StudioSQLiteConnectionConfig } from "src/cli/validations/studio";
|
9
|
+
export declare const preparePgSchema: (path: string | string[]) => Promise<{
|
10
|
+
schema: Record<string, Record<string, AnyPgTable<{}>>>;
|
11
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
12
|
+
}>;
|
13
|
+
export declare const prepareMySqlSchema: (path: string | string[]) => Promise<{
|
14
|
+
schema: Record<string, Record<string, AnyMySqlTable<{}>>>;
|
15
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
16
|
+
}>;
|
17
|
+
export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
|
18
|
+
schema: Record<string, Record<string, AnySQLiteTable<{}>>>;
|
19
|
+
relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
20
|
+
}>;
|
21
|
+
export declare const prepareModels: (path: string | string[]) => Promise<{
|
22
|
+
pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
23
|
+
mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
24
|
+
sqliteSchema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
|
25
|
+
}>;
|
26
|
+
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, ts: {
|
27
|
+
imports: string;
|
28
|
+
declarations: string;
|
29
|
+
schemaEntry: string;
|
30
|
+
}, verbose: boolean) => Promise<Setup>;
|
31
|
+
export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, ts: {
|
32
|
+
imports: string;
|
33
|
+
declarations: string;
|
34
|
+
schemaEntry: string;
|
35
|
+
}, verbose: boolean) => Promise<Setup>;
|
36
|
+
export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, ts: {
|
37
|
+
imports: string;
|
38
|
+
declarations: string;
|
39
|
+
schemaEntry: string;
|
40
|
+
}, verbose: boolean) => Promise<Setup>;
|
41
|
+
export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
|
42
|
+
pgSchema?: Record<string, AnyPgTable | Relations>;
|
43
|
+
mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
|
44
|
+
sqliteSchema?: Record<string, AnySQLiteTable | Relations>;
|
45
|
+
}, logger: boolean) => Promise<{
|
46
|
+
db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
|
47
|
+
type: "pg";
|
48
|
+
schema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
49
|
+
} | {
|
50
|
+
db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
|
51
|
+
type: "mysql";
|
52
|
+
schema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
53
|
+
} | {
|
54
|
+
db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
55
|
+
type: "sqlite";
|
56
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
57
|
+
} | {
|
58
|
+
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
59
|
+
type: "sqlite";
|
60
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
61
|
+
} | {
|
62
|
+
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
63
|
+
type: "sqlite";
|
64
|
+
schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
65
|
+
}>;
|
package/utils-studio.js
CHANGED
@@ -1631,7 +1631,7 @@ var init_pgSerializer = __esm({
|
|
1631
1631
|
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
|
1632
1632
|
FROM pg_attribute a
|
1633
1633
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1634
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1634
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1635
1635
|
AND a.attnum > 0
|
1636
1636
|
AND NOT a.attisdropped
|
1637
1637
|
ORDER BY a.attnum;`
|
package/utils-studio.mjs
CHANGED
@@ -1640,7 +1640,7 @@ var init_pgSerializer = __esm({
|
|
1640
1640
|
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
|
1641
1641
|
FROM pg_attribute a
|
1642
1642
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1643
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1643
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1644
1644
|
AND a.attnum > 0
|
1645
1645
|
AND NOT a.attisdropped
|
1646
1646
|
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>>;
|