drizzle-kit 0.20.0-f39d8bc → 0.20.1-56e7be6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/@types/utils.d.ts +12 -0
  2. package/{index.cjs → bin.cjs} +28995 -37098
  3. package/cli/commands/migrate.d.ts +260 -0
  4. package/cli/commands/mysqlUp.d.ts +4 -0
  5. package/cli/commands/pgConnect.d.ts +5 -0
  6. package/cli/commands/pgIntrospect.d.ts +116 -0
  7. package/cli/commands/pgPushUtils.d.ts +14 -0
  8. package/cli/commands/pgUp.d.ts +4 -0
  9. package/cli/commands/sqliteIntrospect.d.ts +102 -0
  10. package/cli/commands/sqliteUtils.d.ts +162 -0
  11. package/cli/commands/upFolders.d.ts +27 -0
  12. package/cli/commands/utils.d.ts +265 -0
  13. package/cli/selector-ui.d.ts +13 -0
  14. package/cli/utils.d.ts +11 -0
  15. package/cli/validations/common.d.ts +13 -0
  16. package/cli/validations/mysql.d.ts +365 -0
  17. package/cli/validations/outputs.d.ts +40 -0
  18. package/cli/validations/pg.d.ts +438 -0
  19. package/cli/validations/sqlite.d.ts +220 -0
  20. package/cli/validations/studio.d.ts +593 -0
  21. package/cli/views.d.ts +61 -0
  22. package/drivers/index.d.ts +25 -0
  23. package/global.d.ts +3 -0
  24. package/index.d.mts +105 -0
  25. package/index.d.ts +48 -1
  26. package/index.js +31 -0
  27. package/index.mjs +7 -0
  28. package/introspect.d.ts +4 -0
  29. package/jsonDiffer.d.ts +76 -0
  30. package/jsonStatements.d.ts +349 -0
  31. package/migrationPreparator.d.ts +35 -0
  32. package/orm-extenstions/d1-driver/driver.d.ts +8 -0
  33. package/orm-extenstions/d1-driver/session.d.ts +51 -0
  34. package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
  35. package/package.json +26 -9
  36. package/schemaValidator.d.ts +1306 -0
  37. package/serializer/index.d.ts +9 -0
  38. package/serializer/mysqlImports.d.ts +6 -0
  39. package/serializer/mysqlSchema.d.ts +3833 -0
  40. package/serializer/mysqlSerializer.d.ts +7 -0
  41. package/serializer/pgImports.d.ts +11 -0
  42. package/serializer/pgSchema.d.ts +4244 -0
  43. package/serializer/pgSerializer.d.ts +9 -0
  44. package/serializer/sqliteImports.d.ts +5 -0
  45. package/serializer/sqliteSchema.d.ts +3227 -0
  46. package/serializer/sqliteSerializer.d.ts +8 -0
  47. package/serializer/studioUtils.d.ts +53 -0
  48. package/snapshotsDiffer.d.ts +2660 -0
  49. package/sqlgenerator.d.ts +33 -0
  50. package/sqlite-introspect.d.ts +5 -0
  51. package/utils/words.d.ts +7 -0
  52. package/utils-studio.d.ts +5 -0
  53. package/utils-studio.js +3367 -0
  54. package/utils.d.ts +211 -0
  55. package/utils.js +52586 -11755
  56. package/loader.mjs +0 -57
package/utils.d.ts ADDED
@@ -0,0 +1,211 @@
1
+ import { Dialect } from "./schemaValidator";
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 ".";
6
+ export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
7
+ export type Journal = {
8
+ version: string;
9
+ dialect: Dialect;
10
+ entries: {
11
+ idx: number;
12
+ version: string;
13
+ when: number;
14
+ tag: string;
15
+ breakpoints: boolean;
16
+ }[];
17
+ };
18
+ export declare const dryJournal: (dialect: Dialect) => Journal;
19
+ export declare const snapshotsPriorV4: (out: string) => string[];
20
+ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
21
+ meta: string;
22
+ snapshots: string[];
23
+ journal: any;
24
+ };
25
+ export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
26
+ export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
27
+ malformed: string[];
28
+ nonLatest: string[];
29
+ idsMap: Record<string, {
30
+ parent: string;
31
+ snapshots: string[];
32
+ }>;
33
+ rawMap: Record<string, any>;
34
+ };
35
+ export declare const prepareMigrationFolder: (outFolder: string | undefined, dialect: Dialect) => {
36
+ snapshots: string[];
37
+ journal: any;
38
+ };
39
+ export declare const prepareMigrationMeta: (schemas: {
40
+ from: string;
41
+ to: string;
42
+ }[], tables: {
43
+ from: NamedWithSchema;
44
+ to: NamedWithSchema;
45
+ }[], columns: {
46
+ from: {
47
+ table: string;
48
+ schema: string;
49
+ column: string;
50
+ };
51
+ to: {
52
+ table: string;
53
+ schema: string;
54
+ column: string;
55
+ };
56
+ }[]) => {
57
+ schemas: {};
58
+ tables: {};
59
+ columns: {};
60
+ };
61
+ export declare const schemaRenameKey: (it: string) => string;
62
+ export declare const tableRenameKey: (it: NamedWithSchema) => string;
63
+ export declare const columnRenameKey: (table: string, schema: string, column: string) => string;
64
+ export declare const kloudMeta: () => {
65
+ pg: number[];
66
+ mysql: number[];
67
+ sqlite: number[];
68
+ };
69
+ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
70
+ left: {
71
+ internal?: {
72
+ tables: Record<string, {
73
+ columns: Record<string, {
74
+ isArray?: boolean | undefined;
75
+ dimensions?: number | undefined;
76
+ rawType?: string | undefined;
77
+ } | undefined>;
78
+ } | undefined>;
79
+ } | undefined;
80
+ id: string;
81
+ prevId: string;
82
+ version: "5";
83
+ dialect: "pg";
84
+ tables: Record<string, {
85
+ name: string;
86
+ columns: Record<string, {
87
+ isUnique?: any;
88
+ default?: any;
89
+ uniqueName?: string | undefined;
90
+ nullsNotDistinct?: boolean | undefined;
91
+ name: string;
92
+ type: string;
93
+ primaryKey: boolean;
94
+ notNull: boolean;
95
+ }>;
96
+ indexes: Record<string, {
97
+ name: string;
98
+ columns: string[];
99
+ isUnique: boolean;
100
+ }>;
101
+ foreignKeys: Record<string, {
102
+ onUpdate?: string | undefined;
103
+ onDelete?: string | undefined;
104
+ name: string;
105
+ tableFrom: string;
106
+ columnsFrom: string[];
107
+ tableTo: string;
108
+ columnsTo: string[];
109
+ }>;
110
+ schema: string;
111
+ compositePrimaryKeys: Record<string, {
112
+ name: string;
113
+ columns: string[];
114
+ }>;
115
+ uniqueConstraints: Record<string, {
116
+ name: string;
117
+ columns: string[];
118
+ nullsNotDistinct: boolean;
119
+ }>;
120
+ }>;
121
+ schemas: Record<string, string>;
122
+ _meta: {
123
+ columns: Record<string, string>;
124
+ tables: Record<string, string>;
125
+ schemas: Record<string, string>;
126
+ };
127
+ enums: Record<string, {
128
+ name: string;
129
+ values: Record<string, string>;
130
+ }>;
131
+ };
132
+ right: {
133
+ internal?: {
134
+ tables: Record<string, {
135
+ columns: Record<string, {
136
+ isArray?: boolean | undefined;
137
+ dimensions?: number | undefined;
138
+ rawType?: string | undefined;
139
+ } | undefined>;
140
+ } | undefined>;
141
+ } | undefined;
142
+ id: string;
143
+ prevId: string;
144
+ version: "5";
145
+ dialect: "pg";
146
+ tables: Record<string, {
147
+ name: string;
148
+ columns: Record<string, {
149
+ isUnique?: any;
150
+ default?: any;
151
+ uniqueName?: string | undefined;
152
+ nullsNotDistinct?: boolean | undefined;
153
+ name: string;
154
+ type: string;
155
+ primaryKey: boolean;
156
+ notNull: boolean;
157
+ }>;
158
+ indexes: Record<string, {
159
+ name: string;
160
+ columns: string[];
161
+ isUnique: boolean;
162
+ }>;
163
+ foreignKeys: Record<string, {
164
+ onUpdate?: string | undefined;
165
+ onDelete?: string | undefined;
166
+ name: string;
167
+ tableFrom: string;
168
+ columnsFrom: string[];
169
+ tableTo: string;
170
+ columnsTo: string[];
171
+ }>;
172
+ schema: string;
173
+ compositePrimaryKeys: Record<string, {
174
+ name: string;
175
+ columns: string[];
176
+ }>;
177
+ uniqueConstraints: Record<string, {
178
+ name: string;
179
+ columns: string[];
180
+ nullsNotDistinct: boolean;
181
+ }>;
182
+ }>;
183
+ schemas: Record<string, string>;
184
+ _meta: {
185
+ columns: Record<string, string>;
186
+ tables: Record<string, string>;
187
+ schemas: Record<string, string>;
188
+ };
189
+ enums: Record<string, {
190
+ name: string;
191
+ values: Record<string, string>;
192
+ }>;
193
+ };
194
+ statements: import("./jsonStatements").JsonStatement[];
195
+ sqlStatements: string[];
196
+ _meta: {
197
+ schemas: {};
198
+ tables: {};
199
+ columns: {};
200
+ } | undefined;
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>>;