drizzle-kit 0.20.14-22fcd3b → 0.20.14-6ce9d1f
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +41476 -41661
- package/cli/commands/check.d.ts +2 -0
- package/cli/commands/drop.d.ts +4 -0
- package/cli/commands/migrate.d.ts +7 -7
- package/cli/commands/mysqlIntrospect.d.ts +119 -0
- package/cli/commands/mysqlPushUtils.d.ts +18 -0
- package/cli/commands/mysqlUp.d.ts +1 -1
- package/cli/commands/pgConnect.d.ts +1 -1
- package/cli/commands/pgIntrospect.d.ts +1 -1
- package/cli/commands/pgPushUtils.d.ts +2 -2
- package/cli/commands/pgUp.d.ts +1 -1
- package/cli/commands/push.d.ts +6 -0
- package/cli/commands/sqlitePushUtils.d.ts +21 -0
- package/cli/commands/sqliteUp.d.ts +2 -0
- package/cli/commands/upFolders.d.ts +1 -1
- package/cli/commands/utils.d.ts +13 -4
- package/cli/index.d.ts +71 -0
- package/cli/validations/common.d.ts +1 -1
- package/cli/validations/studio.d.ts +16 -16
- package/cli/views.d.ts +1 -1
- package/drivers/index.d.ts +14 -0
- package/global.d.ts +1 -0
- package/index.d.mts +8 -6
- package/index.d.ts +8 -6
- package/introspect-mysql.d.ts +9 -0
- package/package.json +15 -3
- package/payload.d.mts +33 -0
- package/payload.d.ts +33 -0
- package/payload.js +37000 -0
- package/payload.mjs +37019 -0
- package/schemaValidator.d.ts +1 -1
- package/serializer/mysqlImports.d.ts +5 -0
- package/serializer/mysqlSerializer.d.ts +4 -4
- package/serializer/sqliteImports.d.ts +4 -0
- package/serializer/sqliteSerializer.d.ts +2 -2
- package/serializer/studioUtils.d.ts +7 -7
- package/utils/certs.d.ts +4 -0
- package/utils-studio.js +12 -7
- package/utils-studio.mjs +12 -7
- package/utils.d.ts +1 -15
- package/utils.js +3629 -54850
- package/utils.mjs +8076 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
|
2
2
|
import { schema } from "../views";
|
3
|
-
import { PgSchema } from "
|
4
|
-
import { SQLiteSchema } from "
|
5
|
-
import { MySqlSchema } from "
|
6
|
-
import { Journal } from "
|
3
|
+
import { PgSchema } from "../../serializer/pgSchema";
|
4
|
+
import { SQLiteSchema } from "../../serializer/sqliteSchema";
|
5
|
+
import { MySqlSchema } from "../../serializer/mysqlSchema";
|
6
|
+
import { Journal } from "../../utils";
|
7
7
|
import { GenerateConfig } from "./utils";
|
8
8
|
export type Named = {
|
9
9
|
name: string;
|
@@ -132,7 +132,7 @@ export declare const prepareMySQLPush: (config: {
|
|
132
132
|
schemas: Record<string, string>;
|
133
133
|
};
|
134
134
|
};
|
135
|
-
}
|
135
|
+
}>;
|
136
136
|
export declare const prepareSQLitePush: (config: {
|
137
137
|
schema: string | string[];
|
138
138
|
}, snapshot: SQLiteSchema) => Promise<{
|
@@ -183,7 +183,7 @@ export declare const prepareSQLitePush: (config: {
|
|
183
183
|
tables: {};
|
184
184
|
columns: {};
|
185
185
|
} | undefined;
|
186
|
-
}
|
186
|
+
}>;
|
187
187
|
export declare const preparePgPush: (config: {
|
188
188
|
schema: string | string[];
|
189
189
|
}, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
|
@@ -243,7 +243,7 @@ export declare const preparePgPush: (config: {
|
|
243
243
|
values: Record<string, string>;
|
244
244
|
}>;
|
245
245
|
};
|
246
|
-
}
|
246
|
+
}>;
|
247
247
|
export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
|
248
248
|
export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
|
249
249
|
export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
|
@@ -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 "../../jsonStatements";
|
3
|
+
import { mysqlSchema } from "../../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
|
+
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { MySqlSchema, MySqlSchemaV4 } from "
|
1
|
+
import { MySqlSchema, MySqlSchemaV4 } from "../../serializer/mysqlSchema";
|
2
2
|
export declare const upMysqlHandler: (out: string) => void;
|
3
3
|
export declare const upMySqlHandlerV4toV5: (obj: MySqlSchemaV4) => MySqlSchema;
|
4
4
|
export declare const upMysqlHandlerV4: (out: string) => void;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PgConfigIntrospect } from "../validations/pg";
|
2
|
-
import type { DrizzleDbClient } from "
|
2
|
+
import type { DrizzleDbClient } from "../../drivers";
|
3
3
|
export declare const pgSchemas: (client: DrizzleDbClient) => Promise<string[]>;
|
4
4
|
export declare const pgPushIntrospect: (connection: {
|
5
5
|
client: DrizzleDbClient;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { DrizzleDbClient } from "
|
2
|
-
import { JsonStatement } from "
|
1
|
+
import { DrizzleDbClient } from "../../drivers";
|
2
|
+
import { JsonStatement } from "../../jsonStatements";
|
3
3
|
export declare const pgSuggestions: ({ connection, statements, }: {
|
4
4
|
statements: JsonStatement[];
|
5
5
|
connection: DrizzleDbClient;
|
package/cli/commands/pgUp.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PgSchema, PgSchemaV4 } from "
|
1
|
+
import { PgSchema, PgSchemaV4 } from "../../serializer/pgSchema";
|
2
2
|
export declare const upPgHandlerV4toV5: (obj: PgSchemaV4) => PgSchema;
|
3
3
|
export declare const upPgHandler: (out: string) => void;
|
4
4
|
export declare const upPgHandlerV4: (out: string) => void;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { MySQLPushConfig } from "../validations/mysql";
|
2
|
+
import { PgPushConfig } from "../validations/pg";
|
3
|
+
import { SQLitePushConfig } from "../validations/sqlite";
|
4
|
+
export declare const mysqlPush: (drizzleConfig: MySQLPushConfig, tablesFilter: string[]) => Promise<void>;
|
5
|
+
export declare const pgPush: (drizzleConfig: PgPushConfig, tablesFilter: string[]) => Promise<void>;
|
6
|
+
export declare const sqlitePush: (drizzleConfig: SQLitePushConfig, tablesFilter: string[]) => Promise<void>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { DrizzleDbClient } from "../../drivers";
|
2
|
+
import { JsonStatement } from "../../jsonStatements";
|
3
|
+
import { SQLiteSchemaInternal, SQLiteSchemaSquashed } from "../../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
|
+
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Dialect } from "
|
1
|
+
import { Dialect } from "../../schemaValidator";
|
2
2
|
import { Named, NamedWithSchema } from "./migrate";
|
3
3
|
export declare const resolveSchemas: <T extends Named>(missingSchemas: T[], newSchemas: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
|
4
4
|
created: T[];
|
package/cli/commands/utils.d.ts
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
import { TypeOf } from "zod";
|
2
|
+
import { CliParamsPush } from "..";
|
3
|
+
import { MySQLPushConfig } from "../validations/mysql";
|
4
|
+
import { PgPushConfig } from "../validations/pg";
|
5
|
+
import { SQLitePushConfig } from "../validations/sqlite";
|
2
6
|
export declare const safeRegister: () => Promise<{
|
3
7
|
unregister: () => void;
|
4
8
|
}>;
|
@@ -16,6 +20,11 @@ export declare const prepareGenerateConfig: (options: {
|
|
16
20
|
breakpoints: boolean;
|
17
21
|
custom: boolean;
|
18
22
|
}) => Promise<GenerateConfig>;
|
23
|
+
export declare const preparePushConfig: (options: CliParamsPush) => Promise<{
|
24
|
+
config: MySQLPushConfig | PgPushConfig | SQLitePushConfig;
|
25
|
+
schemaFiles: string[];
|
26
|
+
tablesFilter: string[];
|
27
|
+
}>;
|
19
28
|
export declare const assertOutFolder: (it: {
|
20
29
|
config?: string;
|
21
30
|
} | {
|
@@ -31,15 +40,15 @@ export declare const configCommonSchema: import("zod").ZodObject<{
|
|
31
40
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
32
41
|
}, "strip", import("zod").ZodTypeAny, {
|
33
42
|
out?: string | undefined;
|
34
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "
|
43
|
+
driver?: "pg" | "turso" | "better-sqlite" | "libsql" | "d1" | "mysql2" | "expo" | undefined;
|
35
44
|
tablesFilter?: string | string[] | undefined;
|
36
45
|
schema: string | string[];
|
37
46
|
breakpoints: boolean;
|
38
47
|
schemaFilter: string | string[];
|
39
48
|
}, {
|
40
49
|
out?: string | undefined;
|
50
|
+
driver?: "pg" | "turso" | "better-sqlite" | "libsql" | "d1" | "mysql2" | "expo" | undefined;
|
41
51
|
breakpoints?: boolean | undefined;
|
42
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
43
52
|
tablesFilter?: string | string[] | undefined;
|
44
53
|
schemaFilter?: string | string[] | undefined;
|
45
54
|
schema: string | string[];
|
@@ -174,15 +183,15 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
|
|
174
183
|
schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
175
184
|
}, "strip", import("zod").ZodTypeAny, {
|
176
185
|
out?: string | undefined;
|
177
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "
|
186
|
+
driver?: "pg" | "turso" | "better-sqlite" | "libsql" | "d1" | "mysql2" | "expo" | undefined;
|
178
187
|
tablesFilter?: string | string[] | undefined;
|
179
188
|
schema: string | string[];
|
180
189
|
breakpoints: boolean;
|
181
190
|
schemaFilter: string | string[];
|
182
191
|
}, {
|
183
192
|
out?: string | undefined;
|
193
|
+
driver?: "pg" | "turso" | "better-sqlite" | "libsql" | "d1" | "mysql2" | "expo" | undefined;
|
184
194
|
breakpoints?: boolean | undefined;
|
185
|
-
driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
|
186
195
|
tablesFilter?: string | string[] | undefined;
|
187
196
|
schemaFilter?: string | string[] | undefined;
|
188
197
|
schema: string | string[];
|
package/cli/index.d.ts
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
import { TypeOf } from "zod";
|
2
|
+
import "../@types/utils";
|
3
|
+
import "dotenv/config";
|
4
|
+
declare const cliParamsPush: import("zod").ZodObject<{
|
5
|
+
config: import("zod").ZodOptional<import("zod").ZodString>;
|
6
|
+
dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
|
7
|
+
schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
8
|
+
tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
|
9
|
+
driver: import("zod").ZodString;
|
10
|
+
connectionString: import("zod").ZodOptional<import("zod").ZodString>;
|
11
|
+
host: import("zod").ZodOptional<import("zod").ZodString>;
|
12
|
+
port: import("zod").ZodOptional<import("zod").ZodString>;
|
13
|
+
user: import("zod").ZodOptional<import("zod").ZodString>;
|
14
|
+
password: import("zod").ZodOptional<import("zod").ZodString>;
|
15
|
+
database: import("zod").ZodOptional<import("zod").ZodString>;
|
16
|
+
ssl: import("zod").ZodOptional<import("zod").ZodString>;
|
17
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
18
|
+
authToken: import("zod").ZodOptional<import("zod").ZodString>;
|
19
|
+
verbose: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
20
|
+
strict: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
21
|
+
}, "strict", import("zod").ZodTypeAny, {
|
22
|
+
schema?: string | string[] | undefined;
|
23
|
+
authToken?: string | undefined;
|
24
|
+
tablesFilter?: string | string[] | undefined;
|
25
|
+
config?: string | undefined;
|
26
|
+
host?: string | undefined;
|
27
|
+
port?: string | undefined;
|
28
|
+
user?: string | undefined;
|
29
|
+
password?: string | undefined;
|
30
|
+
database?: string | undefined;
|
31
|
+
ssl?: string | undefined;
|
32
|
+
connectionString?: string | undefined;
|
33
|
+
uri?: string | undefined;
|
34
|
+
strict: boolean;
|
35
|
+
dialect: "mysql" | "pg" | "sqlite";
|
36
|
+
driver: string;
|
37
|
+
verbose: boolean;
|
38
|
+
}, {
|
39
|
+
strict?: boolean | undefined;
|
40
|
+
schema?: string | string[] | undefined;
|
41
|
+
authToken?: string | undefined;
|
42
|
+
tablesFilter?: string | string[] | undefined;
|
43
|
+
config?: string | undefined;
|
44
|
+
verbose?: boolean | undefined;
|
45
|
+
host?: string | undefined;
|
46
|
+
port?: string | undefined;
|
47
|
+
user?: string | undefined;
|
48
|
+
password?: string | undefined;
|
49
|
+
database?: string | undefined;
|
50
|
+
ssl?: string | undefined;
|
51
|
+
connectionString?: string | undefined;
|
52
|
+
uri?: string | undefined;
|
53
|
+
dialect: "mysql" | "pg" | "sqlite";
|
54
|
+
driver: string;
|
55
|
+
}>;
|
56
|
+
export type CliParamsPush = TypeOf<typeof cliParamsPush>;
|
57
|
+
export declare const checkSchema: import("zod").ZodObject<{
|
58
|
+
out: import("zod").ZodOptional<import("zod").ZodString>;
|
59
|
+
config: import("zod").ZodOptional<import("zod").ZodString>;
|
60
|
+
driver: import("zod").ZodOptional<import("zod").ZodString>;
|
61
|
+
}, "strict", import("zod").ZodTypeAny, {
|
62
|
+
out?: string | undefined;
|
63
|
+
driver?: string | undefined;
|
64
|
+
config?: string | undefined;
|
65
|
+
}, {
|
66
|
+
out?: string | undefined;
|
67
|
+
driver?: string | undefined;
|
68
|
+
config?: string | undefined;
|
69
|
+
}>;
|
70
|
+
export type CheckConfig = TypeOf<typeof checkSchema>;
|
71
|
+
export {};
|
@@ -3,7 +3,7 @@ export type CollusionCheckOutput = {
|
|
3
3
|
message?: string;
|
4
4
|
action: "config" | "cli" | "error";
|
5
5
|
};
|
6
|
-
export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate
|
6
|
+
export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
|
7
7
|
/**
|
8
8
|
* This function checks an input from a user and if there are any params together with config path - return true
|
9
9
|
* @param options - user input
|
@@ -541,6 +541,22 @@ export type StudioSqliteConnectionConfig = TypeOf<typeof stuioSqliteConnectionCo
|
|
541
541
|
export declare const validateStudio: (options: any) => Promise<{
|
542
542
|
schema: string | string[];
|
543
543
|
} & ({
|
544
|
+
driver: "turso";
|
545
|
+
dbCredentials: {
|
546
|
+
authToken?: string | undefined;
|
547
|
+
url: string;
|
548
|
+
};
|
549
|
+
} | {
|
550
|
+
driver: "libsql";
|
551
|
+
dbCredentials: {
|
552
|
+
url: string;
|
553
|
+
};
|
554
|
+
} | {
|
555
|
+
driver: "better-sqlite";
|
556
|
+
dbCredentials: {
|
557
|
+
url: string;
|
558
|
+
};
|
559
|
+
} | {
|
544
560
|
driver: "pg";
|
545
561
|
dbCredentials: {
|
546
562
|
type?: "params" | undefined;
|
@@ -557,22 +573,6 @@ export declare const validateStudio: (options: any) => Promise<{
|
|
557
573
|
type?: "url" | undefined;
|
558
574
|
connectionString: string;
|
559
575
|
};
|
560
|
-
} | {
|
561
|
-
driver: "turso";
|
562
|
-
dbCredentials: {
|
563
|
-
authToken?: string | undefined;
|
564
|
-
url: string;
|
565
|
-
};
|
566
|
-
} | {
|
567
|
-
driver: "libsql";
|
568
|
-
dbCredentials: {
|
569
|
-
url: string;
|
570
|
-
};
|
571
|
-
} | {
|
572
|
-
driver: "better-sqlite";
|
573
|
-
dbCredentials: {
|
574
|
-
url: string;
|
575
|
-
};
|
576
576
|
} | {
|
577
577
|
driver: "mysql2";
|
578
578
|
dbCredentials: {
|
package/cli/views.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Prompt, TaskView } from "hanji";
|
2
|
-
import type { CommonSchema } from "
|
2
|
+
import type { CommonSchema } from "../schemaValidator";
|
3
3
|
import type { Named } from "./commands/migrate";
|
4
4
|
export declare const warning: (msg: string) => void;
|
5
5
|
export declare const err: (msg: string) => void;
|
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>;
|
package/index.d.mts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Dialect } from "./schemaValidator";
|
1
2
|
export type DbConnection = {
|
2
3
|
driver: "turso";
|
3
4
|
dbCredentials: {
|
@@ -45,13 +46,14 @@ export type DbConnection = {
|
|
45
46
|
};
|
46
47
|
};
|
47
48
|
export type Config = {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
dialect?: Dialect;
|
50
|
+
out?: string;
|
51
|
+
breakpoints?: boolean;
|
52
|
+
tablesFilter?: string | string[];
|
53
|
+
schemaFilter?: string | string[];
|
52
54
|
schema?: string | string[];
|
53
|
-
verbose?: boolean
|
54
|
-
strict?: boolean
|
55
|
+
verbose?: boolean;
|
56
|
+
strict?: boolean;
|
55
57
|
} & {
|
56
58
|
introspect?: {
|
57
59
|
casing: "camel" | "preserve";
|
package/index.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Dialect } from "./schemaValidator";
|
1
2
|
export type DbConnection = {
|
2
3
|
driver: "turso";
|
3
4
|
dbCredentials: {
|
@@ -45,13 +46,14 @@ export type DbConnection = {
|
|
45
46
|
};
|
46
47
|
};
|
47
48
|
export type Config = {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
dialect?: Dialect;
|
50
|
+
out?: string;
|
51
|
+
breakpoints?: boolean;
|
52
|
+
tablesFilter?: string | string[];
|
53
|
+
schemaFilter?: string | string[];
|
52
54
|
schema?: string | string[];
|
53
|
-
verbose?: boolean
|
54
|
-
strict?: boolean
|
55
|
+
verbose?: boolean;
|
56
|
+
strict?: boolean;
|
55
57
|
} & {
|
56
58
|
introspect?: {
|
57
59
|
casing: "camel" | "preserve";
|
@@ -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-6ce9d1f",
|
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",
|
@@ -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.4.2",
|
77
77
|
"@types/better-sqlite3": "^7.6.4",
|
78
78
|
"@types/dockerode": "^3.3.14",
|
79
79
|
"@types/glob": "^8.1.0",
|
@@ -128,6 +128,18 @@
|
|
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"
|
131
143
|
}
|
132
144
|
}
|
133
145
|
}
|
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
|
+
}>;
|