drizzle-kit 0.20.5-1f065b5 → 0.20.5-c7dc2fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.cjs +32027 -32060
- package/cli/utils.d.ts +11 -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 +5 -16
- 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 +53 -0
- package/utils-studio.js +6 -5
- package/utils-studio.mjs +6 -5
- package/utils.d.ts +15 -1
- package/utils.js +52891 -3593
- package/cli/commands/mysqlIntrospect.d.ts +0 -114
- package/cli/commands/mysqlPushUtils.d.ts +0 -17
- package/cli/commands/sqlitePushUtils.d.ts +0 -21
- package/mysql-introspect.d.ts +0 -4
- package/payload.d.mts +0 -33
- package/payload.d.ts +0 -33
- package/payload.js +0 -36761
- package/payload.mjs +0 -36809
- package/utils.mjs +0 -8055
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.20.5-
|
3
|
+
"version": "0.20.5-c7dc2fe",
|
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:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/
|
13
|
+
"migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema2.ts",
|
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",
|
@@ -61,6 +61,7 @@
|
|
61
61
|
"camelcase": "^7.0.1",
|
62
62
|
"chalk": "^5.2.0",
|
63
63
|
"commander": "^9.4.1",
|
64
|
+
"drizzle-kit": "0.19.13",
|
64
65
|
"esbuild": "^0.18.6",
|
65
66
|
"esbuild-register": "^3.4.2",
|
66
67
|
"glob": "^8.1.0",
|
@@ -85,7 +86,7 @@
|
|
85
86
|
"better-sqlite3": "^8.4.0",
|
86
87
|
"dockerode": "^3.3.4",
|
87
88
|
"dotenv": "^16.0.3",
|
88
|
-
"drizzle-orm": "0.29.0
|
89
|
+
"drizzle-orm": "0.29.0",
|
89
90
|
"esbuild-node-externals": "^1.9.0",
|
90
91
|
"eslint": "^8.29.0",
|
91
92
|
"eslint-config-prettier": "^8.5.0",
|
@@ -124,18 +125,6 @@
|
|
124
125
|
},
|
125
126
|
"types": "./utils-studio.d.mts",
|
126
127
|
"default": "./utils-studio.mjs"
|
127
|
-
},
|
128
|
-
"./payload": {
|
129
|
-
"import": {
|
130
|
-
"types": "./payload.d.mts",
|
131
|
-
"default": "./payload.mjs"
|
132
|
-
},
|
133
|
-
"require": {
|
134
|
-
"types": "./payload.d.ts",
|
135
|
-
"default": "./payload.js"
|
136
|
-
},
|
137
|
-
"types": "./payload.d.mts",
|
138
|
-
"default": "./payload.mjs"
|
139
128
|
}
|
140
129
|
}
|
141
130
|
}
|
@@ -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,53 @@
|
|
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, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
|
25
|
+
}>;
|
26
|
+
export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
27
|
+
export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
28
|
+
export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
|
29
|
+
export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
|
30
|
+
pgSchema?: Record<string, AnyPgTable | Relations>;
|
31
|
+
mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
|
32
|
+
sqliteSchema?: Record<string, AnySQLiteTable | Relations>;
|
33
|
+
}, logger: boolean) => Promise<{
|
34
|
+
db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
|
35
|
+
type: "pg";
|
36
|
+
schema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
37
|
+
} | {
|
38
|
+
db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
|
39
|
+
type: "mysql";
|
40
|
+
schema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
|
41
|
+
} | {
|
42
|
+
db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
|
43
|
+
type: "sqlite";
|
44
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
45
|
+
} | {
|
46
|
+
db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
|
47
|
+
type: "sqlite";
|
48
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
49
|
+
} | {
|
50
|
+
db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
|
51
|
+
type: "sqlite";
|
52
|
+
schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
|
53
|
+
}>;
|
package/utils-studio.js
CHANGED
@@ -739,12 +739,13 @@ var init_pgSerializer = __esm({
|
|
739
739
|
if (cprimaryKey.length > 1) {
|
740
740
|
const tableCompositePkName = await db.query(
|
741
741
|
`SELECT conname AS primary_key
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
742
|
+
FROM pg_constraint join pg_class on (pg_class.oid = conrelid)
|
743
|
+
WHERE contype = 'p'
|
744
|
+
AND connamespace = $1::regnamespace
|
745
|
+
AND pg_class.relname = $2;`,
|
746
|
+
[tableSchema, tableName]
|
746
747
|
);
|
747
|
-
primaryKeys[
|
748
|
+
primaryKeys[tableCompositePkName[0].primary_key] = {
|
748
749
|
name: tableCompositePkName[0].primary_key,
|
749
750
|
columns: cprimaryKey.map((c) => c.column_name)
|
750
751
|
};
|
package/utils-studio.mjs
CHANGED
@@ -771,12 +771,13 @@ var init_pgSerializer = __esm({
|
|
771
771
|
if (cprimaryKey.length > 1) {
|
772
772
|
const tableCompositePkName = await db.query(
|
773
773
|
`SELECT conname AS primary_key
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
774
|
+
FROM pg_constraint join pg_class on (pg_class.oid = conrelid)
|
775
|
+
WHERE contype = 'p'
|
776
|
+
AND connamespace = $1::regnamespace
|
777
|
+
AND pg_class.relname = $2;`,
|
778
|
+
[tableSchema, tableName]
|
778
779
|
);
|
779
|
-
primaryKeys[
|
780
|
+
primaryKeys[tableCompositePkName[0].primary_key] = {
|
780
781
|
name: tableCompositePkName[0].primary_key,
|
781
782
|
columns: cprimaryKey.map((c) => c.column_name)
|
782
783
|
};
|
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[];
|
@@ -195,3 +199,13 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
|
|
195
199
|
columns: {};
|
196
200
|
} | undefined;
|
197
201
|
}>;
|
202
|
+
export type DrizzleSnapshotJSON = PgSchemaKit;
|
203
|
+
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
204
|
+
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
205
|
+
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
206
|
+
hasDataLoss: boolean;
|
207
|
+
warnings: string[];
|
208
|
+
statementsToExecute: string[];
|
209
|
+
apply: () => Promise<void>;
|
210
|
+
}>;
|
211
|
+
export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;
|