drizzle-kit 0.19.13-e99bac1 → 0.19.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/index.cjs +30505 -21937
  2. package/index.d.ts +14 -15
  3. package/package.json +2 -3
  4. package/utils.js +11760 -35976
  5. package/@types/utils.d.ts +0 -12
  6. package/cli/commands/migrate.d.ts +0 -141
  7. package/cli/commands/mysqlUp.d.ts +0 -4
  8. package/cli/commands/pgIntrospect.d.ts +0 -118
  9. package/cli/commands/pgPushUtils.d.ts +0 -14
  10. package/cli/commands/pgUp.d.ts +0 -4
  11. package/cli/commands/sqliteIntrospect.d.ts +0 -102
  12. package/cli/commands/sqliteUtils.d.ts +0 -162
  13. package/cli/commands/upFolders.d.ts +0 -27
  14. package/cli/commands/utils.d.ts +0 -265
  15. package/cli/selector-ui.d.ts +0 -13
  16. package/cli/validations/common.d.ts +0 -13
  17. package/cli/validations/mysql.d.ts +0 -414
  18. package/cli/validations/outputs.d.ts +0 -39
  19. package/cli/validations/pg.d.ts +0 -438
  20. package/cli/validations/sqlite.d.ts +0 -220
  21. package/cli/validations/studio.d.ts +0 -469
  22. package/cli/views.d.ts +0 -61
  23. package/drivers/index.d.ts +0 -26
  24. package/global.d.ts +0 -2
  25. package/introspect.d.ts +0 -4
  26. package/jsonDiffer.d.ts +0 -76
  27. package/jsonStatements.d.ts +0 -349
  28. package/migrationPreparator.d.ts +0 -35
  29. package/schemaValidator.d.ts +0 -1236
  30. package/serializer/index.d.ts +0 -9
  31. package/serializer/mysqlImports.d.ts +0 -6
  32. package/serializer/mysqlSchema.d.ts +0 -3833
  33. package/serializer/mysqlSerializer.d.ts +0 -7
  34. package/serializer/pgImports.d.ts +0 -11
  35. package/serializer/pgSchema.d.ts +0 -4000
  36. package/serializer/pgSerializer.d.ts +0 -7
  37. package/serializer/sqliteImports.d.ts +0 -5
  38. package/serializer/sqliteSchema.d.ts +0 -3162
  39. package/serializer/sqliteSerializer.d.ts +0 -8
  40. package/serializer/studioUtils.d.ts +0 -31
  41. package/snapshotsDiffer.d.ts +0 -2660
  42. package/sqlgenerator.d.ts +0 -33
  43. package/sqlite-introspect.d.ts +0 -5
  44. package/utils/words.d.ts +0 -7
  45. package/utils.d.ts +0 -32
  46. package/utilsR.d.ts +0 -209
package/@types/utils.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare global {
2
- interface String {
3
- trimChar(char: string): string;
4
- squashSpaces(): string;
5
- camelCase(): string;
6
- concatIf(it: string, condition: boolean): string;
7
- }
8
- interface Array<T> {
9
- random(): T;
10
- }
11
- }
12
- export {};
@@ -1,141 +0,0 @@
1
- import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
2
- import { schema } from "../views";
3
- import { PgSchema } from "src/serializer/pgSchema";
4
- import { SQLiteSchema } from "src/serializer/sqliteSchema";
5
- import { MySqlSchema } from "src/serializer/mysqlSchema";
6
- import { Journal } from "src/utilsR";
7
- import { GenerateConfig } from "./utils";
8
- export type Named = {
9
- name: string;
10
- };
11
- export type NamedWithSchema = {
12
- name: string;
13
- schema?: string;
14
- };
15
- export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
16
- export declare const prepareMySQLPush: (config: {
17
- schema: string | string[];
18
- }, snapshot: MySqlSchema) => Promise<{
19
- sqlStatements: string[];
20
- statements: import("../../jsonStatements").JsonStatement[];
21
- } | undefined>;
22
- export declare const prepareSQLitePush: (config: {
23
- schema: string | string[];
24
- }, snapshot: SQLiteSchema) => Promise<{
25
- sqlStatements: string[];
26
- statements: import("../../jsonStatements").JsonStatement[];
27
- squashedPrev: {
28
- enums?: any;
29
- version: "5";
30
- dialect: "sqlite";
31
- tables: Record<string, {
32
- name: string;
33
- columns: Record<string, {
34
- default?: any;
35
- autoincrement?: boolean | undefined;
36
- name: string;
37
- type: string;
38
- primaryKey: boolean;
39
- notNull: boolean;
40
- }>;
41
- indexes: Record<string, string>;
42
- foreignKeys: Record<string, string>;
43
- compositePrimaryKeys: Record<string, string>;
44
- uniqueConstraints: Record<string, string>;
45
- }>;
46
- };
47
- squashedCur: {
48
- enums?: any;
49
- version: "5";
50
- dialect: "sqlite";
51
- tables: Record<string, {
52
- name: string;
53
- columns: Record<string, {
54
- default?: any;
55
- autoincrement?: boolean | undefined;
56
- name: string;
57
- type: string;
58
- primaryKey: boolean;
59
- notNull: boolean;
60
- }>;
61
- indexes: Record<string, string>;
62
- foreignKeys: Record<string, string>;
63
- compositePrimaryKeys: Record<string, string>;
64
- uniqueConstraints: Record<string, string>;
65
- }>;
66
- };
67
- } | undefined>;
68
- export declare const preparePgPush: (config: {
69
- schema: string | string[];
70
- }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
71
- sqlStatements: string[];
72
- statements: import("../../jsonStatements").JsonStatement[];
73
- squashedPrev: {
74
- version: "5";
75
- dialect: "pg";
76
- tables: Record<string, {
77
- name: string;
78
- columns: Record<string, {
79
- isUnique?: any;
80
- default?: any;
81
- uniqueName?: string | undefined;
82
- nullsNotDistinct?: boolean | undefined;
83
- name: string;
84
- type: string;
85
- primaryKey: boolean;
86
- notNull: boolean;
87
- }>;
88
- indexes: Record<string, string>;
89
- foreignKeys: Record<string, string>;
90
- schema: string;
91
- compositePrimaryKeys: Record<string, string>;
92
- uniqueConstraints: Record<string, string>;
93
- }>;
94
- schemas: Record<string, string>;
95
- enums: Record<string, {
96
- name: string;
97
- values: Record<string, string>;
98
- }>;
99
- };
100
- squashedCur: {
101
- version: "5";
102
- dialect: "pg";
103
- tables: Record<string, {
104
- name: string;
105
- columns: Record<string, {
106
- isUnique?: any;
107
- default?: any;
108
- uniqueName?: string | undefined;
109
- nullsNotDistinct?: boolean | undefined;
110
- name: string;
111
- type: string;
112
- primaryKey: boolean;
113
- notNull: boolean;
114
- }>;
115
- indexes: Record<string, string>;
116
- foreignKeys: Record<string, string>;
117
- schema: string;
118
- compositePrimaryKeys: Record<string, string>;
119
- uniqueConstraints: Record<string, string>;
120
- }>;
121
- schemas: Record<string, string>;
122
- enums: Record<string, {
123
- name: string;
124
- values: Record<string, string>;
125
- }>;
126
- };
127
- } | undefined>;
128
- export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
129
- export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
130
- export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
131
- statements: import("../../jsonStatements").JsonStatement[];
132
- sqlStatements: string[];
133
- _meta: {
134
- schemas: {};
135
- tables: {};
136
- columns: {};
137
- } | undefined;
138
- }>;
139
- export declare const BREAKPOINT = "--> statement-breakpoint\n";
140
- export declare const writeResult: (cur: CommonSchema, sqlStatements: string[], journal: Journal, _meta: any, outFolder: string, breakpoints: boolean, type?: "introspect" | "custom" | "none") => void;
141
- export declare const prepareSnapshotFolderName: () => string;
@@ -1,4 +0,0 @@
1
- import { MySqlSchema, MySqlSchemaV4 } from "src/serializer/mysqlSchema";
2
- export declare const upMysqlHandler: (out: string) => void;
3
- export declare const upMySqlHandlerV4toV5: (obj: MySqlSchemaV4) => MySqlSchema;
4
- export declare const upMysqlHandlerV4: (out: string) => void;
@@ -1,118 +0,0 @@
1
- import { PgConfigIntrospect, PgConnectionConfig } from "../validations/pg";
2
- import { DrizzleDbClient, PgPostgres } from "src/drivers";
3
- export declare const connectToPg: (config: PgConnectionConfig) => Promise<{
4
- client: PgPostgres;
5
- }>;
6
- export declare const pgPushIntrospect: (connection: {
7
- client: DrizzleDbClient;
8
- }, filters: string[], schemaFilters: string[]) => Promise<{
9
- schema: {
10
- id: string;
11
- prevId: string;
12
- version: "5";
13
- dialect: "pg";
14
- tables: Record<string, {
15
- name: string;
16
- columns: Record<string, {
17
- isUnique?: any;
18
- default?: any;
19
- uniqueName?: string | undefined;
20
- nullsNotDistinct?: boolean | undefined;
21
- name: string;
22
- type: string;
23
- primaryKey: boolean;
24
- notNull: boolean;
25
- }>;
26
- indexes: Record<string, {
27
- name: string;
28
- columns: string[];
29
- isUnique: boolean;
30
- }>;
31
- foreignKeys: Record<string, {
32
- onUpdate?: string | undefined;
33
- onDelete?: string | undefined;
34
- name: string;
35
- tableFrom: string;
36
- columnsFrom: string[];
37
- tableTo: string;
38
- columnsTo: string[];
39
- }>;
40
- schema: string;
41
- compositePrimaryKeys: Record<string, {
42
- name: string;
43
- columns: string[];
44
- }>;
45
- uniqueConstraints: Record<string, {
46
- name: string;
47
- columns: string[];
48
- nullsNotDistinct: boolean;
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
- enums: Record<string, {
58
- name: string;
59
- values: Record<string, string>;
60
- }>;
61
- };
62
- }>;
63
- export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[], schemaFilters: string[]) => Promise<{
64
- schema: {
65
- id: string;
66
- prevId: string;
67
- version: "5";
68
- dialect: "pg";
69
- tables: Record<string, {
70
- name: string;
71
- columns: Record<string, {
72
- isUnique?: any;
73
- default?: any;
74
- uniqueName?: string | undefined;
75
- nullsNotDistinct?: boolean | undefined;
76
- name: string;
77
- type: string;
78
- primaryKey: boolean;
79
- notNull: boolean;
80
- }>;
81
- indexes: Record<string, {
82
- name: string;
83
- columns: string[];
84
- isUnique: boolean;
85
- }>;
86
- foreignKeys: Record<string, {
87
- onUpdate?: string | undefined;
88
- onDelete?: string | undefined;
89
- name: string;
90
- tableFrom: string;
91
- columnsFrom: string[];
92
- tableTo: string;
93
- columnsTo: string[];
94
- }>;
95
- schema: string;
96
- compositePrimaryKeys: Record<string, {
97
- name: string;
98
- columns: string[];
99
- }>;
100
- uniqueConstraints: Record<string, {
101
- name: string;
102
- columns: string[];
103
- nullsNotDistinct: boolean;
104
- }>;
105
- }>;
106
- schemas: Record<string, string>;
107
- _meta: {
108
- columns: Record<string, string>;
109
- tables: Record<string, string>;
110
- schemas: Record<string, string>;
111
- };
112
- enums: Record<string, {
113
- name: string;
114
- values: Record<string, string>;
115
- }>;
116
- };
117
- ts: string;
118
- }>;
@@ -1,14 +0,0 @@
1
- import { DrizzleDbClient } from "src/drivers";
2
- import { JsonStatement } from "src/jsonStatements";
3
- export declare const pgSuggestions: ({ connection, statements, }: {
4
- statements: JsonStatement[];
5
- connection: DrizzleDbClient;
6
- }) => Promise<{
7
- statementsToExecute: string[];
8
- shouldAskForApprove: boolean;
9
- infoToPrint: string[];
10
- columnsToRemove: string[];
11
- schemasToRemove: string[];
12
- tablesToTruncate: string[];
13
- tablesToRemove: string[];
14
- }>;
@@ -1,4 +0,0 @@
1
- import { PgSchema, PgSchemaV4 } from "src/serializer/pgSchema";
2
- export declare const upPgHandlerV4toV5: (obj: PgSchemaV4) => PgSchema;
3
- export declare const upPgHandler: (out: string) => void;
4
- export declare const upPgHandlerV4: (out: string) => void;
@@ -1,102 +0,0 @@
1
- import { SQLiteCliConfig, SQLiteConnectionConfig } from "./sqliteUtils";
2
- import { BetterSqlite, DrizzleDbClient, TursoSqlite } from "src/drivers";
3
- export declare const connectToSQLite: (config: SQLiteConnectionConfig) => Promise<{
4
- client: BetterSqlite;
5
- } | {
6
- client: TursoSqlite;
7
- } | {
8
- client?: undefined;
9
- }>;
10
- export declare const sqliteIntrospect: (config: SQLiteCliConfig, filters: string[]) => Promise<{
11
- schema: {
12
- id: string;
13
- prevId: string;
14
- version: "5";
15
- dialect: "sqlite";
16
- tables: Record<string, {
17
- name: string;
18
- columns: Record<string, {
19
- default?: any;
20
- autoincrement?: boolean | undefined;
21
- name: string;
22
- type: string;
23
- primaryKey: boolean;
24
- notNull: boolean;
25
- }>;
26
- indexes: Record<string, {
27
- where?: string | undefined;
28
- name: string;
29
- columns: string[];
30
- isUnique: boolean;
31
- }>;
32
- foreignKeys: Record<string, {
33
- onUpdate?: string | undefined;
34
- onDelete?: string | undefined;
35
- name: string;
36
- tableFrom: string;
37
- columnsFrom: string[];
38
- tableTo: string;
39
- columnsTo: string[];
40
- }>;
41
- compositePrimaryKeys: Record<string, {
42
- columns: string[];
43
- }>;
44
- uniqueConstraints: Record<string, {
45
- name: string;
46
- columns: string[];
47
- }>;
48
- }>;
49
- _meta: {
50
- columns: Record<string, string>;
51
- tables: Record<string, string>;
52
- };
53
- enums: {};
54
- };
55
- ts: string;
56
- }>;
57
- export declare const sqlitePushIntrospect: (client: DrizzleDbClient, filters: string[]) => Promise<{
58
- schema: {
59
- id: string;
60
- prevId: string;
61
- version: "5";
62
- dialect: "sqlite";
63
- tables: Record<string, {
64
- name: string;
65
- columns: Record<string, {
66
- default?: any;
67
- autoincrement?: boolean | undefined;
68
- name: string;
69
- type: string;
70
- primaryKey: boolean;
71
- notNull: boolean;
72
- }>;
73
- indexes: Record<string, {
74
- where?: string | undefined;
75
- name: string;
76
- columns: string[];
77
- isUnique: boolean;
78
- }>;
79
- foreignKeys: Record<string, {
80
- onUpdate?: string | undefined;
81
- onDelete?: string | undefined;
82
- name: string;
83
- tableFrom: string;
84
- columnsFrom: string[];
85
- tableTo: string;
86
- columnsTo: string[];
87
- }>;
88
- compositePrimaryKeys: Record<string, {
89
- columns: string[];
90
- }>;
91
- uniqueConstraints: Record<string, {
92
- name: string;
93
- columns: string[];
94
- }>;
95
- }>;
96
- _meta: {
97
- columns: Record<string, string>;
98
- tables: Record<string, string>;
99
- };
100
- enums: {};
101
- };
102
- }>;
@@ -1,162 +0,0 @@
1
- import { TypeOf } from "zod";
2
- import { configIntrospectSchema } from "./utils";
3
- export declare const sqliteConnectionSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
4
- driver: import("zod").ZodLiteral<"turso">;
5
- dbCredentials: import("zod").ZodObject<{
6
- url: import("zod").ZodString;
7
- authToken: import("zod").ZodOptional<import("zod").ZodString>;
8
- }, "strip", import("zod").ZodTypeAny, {
9
- authToken?: string | undefined;
10
- url: string;
11
- }, {
12
- authToken?: string | undefined;
13
- url: string;
14
- }>;
15
- }, "strip", import("zod").ZodTypeAny, {
16
- driver: "turso";
17
- dbCredentials: {
18
- authToken?: string | undefined;
19
- url: string;
20
- };
21
- }, {
22
- driver: "turso";
23
- dbCredentials: {
24
- authToken?: string | undefined;
25
- url: string;
26
- };
27
- }>, import("zod").ZodObject<{
28
- driver: import("zod").ZodLiteral<"libsql">;
29
- dbCredentials: import("zod").ZodObject<{
30
- url: import("zod").ZodString;
31
- }, "strip", import("zod").ZodTypeAny, {
32
- url: string;
33
- }, {
34
- url: string;
35
- }>;
36
- }, "strip", import("zod").ZodTypeAny, {
37
- driver: "libsql";
38
- dbCredentials: {
39
- url: string;
40
- };
41
- }, {
42
- driver: "libsql";
43
- dbCredentials: {
44
- url: string;
45
- };
46
- }>, import("zod").ZodObject<{
47
- driver: import("zod").ZodLiteral<"better-sqlite">;
48
- dbCredentials: import("zod").ZodObject<{
49
- url: import("zod").ZodString;
50
- }, "strip", import("zod").ZodTypeAny, {
51
- url: string;
52
- }, {
53
- url: string;
54
- }>;
55
- }, "strip", import("zod").ZodTypeAny, {
56
- driver: "better-sqlite";
57
- dbCredentials: {
58
- url: string;
59
- };
60
- }, {
61
- driver: "better-sqlite";
62
- dbCredentials: {
63
- url: string;
64
- };
65
- }>]>;
66
- export declare const sqliteCliConfigSchema: import("zod").ZodIntersection<import("zod").ZodObject<{
67
- schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
68
- out: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
69
- breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
70
- tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
71
- schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
72
- introspect: import("zod").ZodDefault<import("zod").ZodObject<{
73
- casing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
74
- }, "strip", import("zod").ZodTypeAny, {
75
- casing: "camel" | "preserve";
76
- }, {
77
- casing?: "camel" | "preserve" | undefined;
78
- }>>;
79
- }, "strip", import("zod").ZodTypeAny, {
80
- schema?: string | string[] | undefined;
81
- tablesFilter?: string | string[] | undefined;
82
- out: string;
83
- breakpoints: boolean;
84
- schemaFilter: string | string[];
85
- introspect: {
86
- casing: "camel" | "preserve";
87
- };
88
- }, {
89
- schema?: string | string[] | undefined;
90
- out?: string | undefined;
91
- breakpoints?: boolean | undefined;
92
- tablesFilter?: string | string[] | undefined;
93
- schemaFilter?: string | string[] | undefined;
94
- introspect?: {
95
- casing?: "camel" | "preserve" | undefined;
96
- } | undefined;
97
- }>, import("zod").ZodUnion<[import("zod").ZodObject<{
98
- driver: import("zod").ZodLiteral<"turso">;
99
- dbCredentials: import("zod").ZodObject<{
100
- url: import("zod").ZodString;
101
- authToken: import("zod").ZodOptional<import("zod").ZodString>;
102
- }, "strip", import("zod").ZodTypeAny, {
103
- authToken?: string | undefined;
104
- url: string;
105
- }, {
106
- authToken?: string | undefined;
107
- url: string;
108
- }>;
109
- }, "strip", import("zod").ZodTypeAny, {
110
- driver: "turso";
111
- dbCredentials: {
112
- authToken?: string | undefined;
113
- url: string;
114
- };
115
- }, {
116
- driver: "turso";
117
- dbCredentials: {
118
- authToken?: string | undefined;
119
- url: string;
120
- };
121
- }>, import("zod").ZodObject<{
122
- driver: import("zod").ZodLiteral<"libsql">;
123
- dbCredentials: import("zod").ZodObject<{
124
- url: import("zod").ZodString;
125
- }, "strip", import("zod").ZodTypeAny, {
126
- url: string;
127
- }, {
128
- url: string;
129
- }>;
130
- }, "strip", import("zod").ZodTypeAny, {
131
- driver: "libsql";
132
- dbCredentials: {
133
- url: string;
134
- };
135
- }, {
136
- driver: "libsql";
137
- dbCredentials: {
138
- url: string;
139
- };
140
- }>, import("zod").ZodObject<{
141
- driver: import("zod").ZodLiteral<"better-sqlite">;
142
- dbCredentials: import("zod").ZodObject<{
143
- url: import("zod").ZodString;
144
- }, "strip", import("zod").ZodTypeAny, {
145
- url: string;
146
- }, {
147
- url: string;
148
- }>;
149
- }, "strip", import("zod").ZodTypeAny, {
150
- driver: "better-sqlite";
151
- dbCredentials: {
152
- url: string;
153
- };
154
- }, {
155
- driver: "better-sqlite";
156
- dbCredentials: {
157
- url: string;
158
- };
159
- }>]>>;
160
- export type SQLiteCliConfig = TypeOf<typeof sqliteCliConfigSchema>;
161
- export type SQLiteConnectionConfig = TypeOf<typeof sqliteConnectionSchema>;
162
- export { configIntrospectSchema };
@@ -1,27 +0,0 @@
1
- import { Dialect } from "src/schemaValidator";
2
- import { Named, NamedWithSchema } from "./migrate";
3
- export declare const resolveSchemas: <T extends Named>(missingSchemas: T[], newSchemas: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
4
- created: T[];
5
- renamed: {
6
- from: T;
7
- to: T;
8
- }[];
9
- deleted: T[];
10
- };
11
- export declare const resolveTables: <T extends NamedWithSchema>(missingTables: T[], newTables: T[], resolver: (leftMissing: T[], created: T) => T | undefined) => {
12
- created: T[];
13
- renamed: {
14
- from: T;
15
- to: T;
16
- }[];
17
- deleted: T[];
18
- };
19
- export declare const resolveColumns: <T extends Named>(missingColumns: T[], newColumns: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
20
- created: T[];
21
- renamed: {
22
- from: T;
23
- to: T;
24
- }[];
25
- deleted: T[];
26
- };
27
- export declare const upgradeFolders: (dialect: Dialect, out: string) => void;