drizzle-kit 0.20.0-baf960c → 0.20.0-e4ed989

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/@types/utils.d.ts +12 -0
  2. package/cli/commands/migrate.d.ts +260 -0
  3. package/cli/commands/mysqlUp.d.ts +4 -0
  4. package/cli/commands/pgIntrospect.d.ts +118 -0
  5. package/cli/commands/pgPushUtils.d.ts +14 -0
  6. package/cli/commands/pgUp.d.ts +4 -0
  7. package/cli/commands/sqliteIntrospect.d.ts +102 -0
  8. package/cli/commands/sqliteUtils.d.ts +162 -0
  9. package/cli/commands/upFolders.d.ts +27 -0
  10. package/cli/commands/utils.d.ts +265 -0
  11. package/cli/selector-ui.d.ts +13 -0
  12. package/cli/validations/common.d.ts +13 -0
  13. package/cli/validations/mysql.d.ts +414 -0
  14. package/cli/validations/outputs.d.ts +40 -0
  15. package/cli/validations/pg.d.ts +438 -0
  16. package/cli/validations/sqlite.d.ts +220 -0
  17. package/cli/validations/studio.d.ts +548 -0
  18. package/cli/views.d.ts +61 -0
  19. package/drivers/index.d.ts +25 -0
  20. package/global.d.ts +2 -0
  21. package/index.cjs +28660 -37115
  22. package/index.d.ts +48 -1
  23. package/introspect.d.ts +4 -0
  24. package/jsonDiffer.d.ts +76 -0
  25. package/jsonStatements.d.ts +349 -0
  26. package/migrationPreparator.d.ts +35 -0
  27. package/orm-extenstions/d1-driver/driver.d.ts +8 -0
  28. package/orm-extenstions/d1-driver/session.d.ts +52 -0
  29. package/orm-extenstions/d1-driver/wrangler-client.d.ts +3 -0
  30. package/package.json +4 -3
  31. package/schemaValidator.d.ts +1306 -0
  32. package/serializer/index.d.ts +9 -0
  33. package/serializer/mysqlImports.d.ts +6 -0
  34. package/serializer/mysqlSchema.d.ts +3833 -0
  35. package/serializer/mysqlSerializer.d.ts +7 -0
  36. package/serializer/pgImports.d.ts +11 -0
  37. package/serializer/pgSchema.d.ts +4244 -0
  38. package/serializer/pgSerializer.d.ts +9 -0
  39. package/serializer/sqliteImports.d.ts +5 -0
  40. package/serializer/sqliteSchema.d.ts +3227 -0
  41. package/serializer/sqliteSerializer.d.ts +8 -0
  42. package/serializer/studioUtils.d.ts +35 -0
  43. package/snapshotsDiffer.d.ts +2660 -0
  44. package/sqlgenerator.d.ts +33 -0
  45. package/sqlite-introspect.d.ts +5 -0
  46. package/utils/words.d.ts +7 -0
  47. package/utils.d.ts +236 -0
  48. package/utils.js +51720 -11744
@@ -0,0 +1,33 @@
1
+ import { JsonCreateIndexStatement, JsonDropIndexStatement, JsonDropTableStatement, JsonRenameTableStatement, JsonSqliteAddColumnStatement, JsonSqliteCreateTableStatement, JsonStatement } from "./jsonStatements";
2
+ import { Dialect } from "./schemaValidator";
3
+ export declare const pgNativeTypes: Set<string>;
4
+ declare abstract class Convertor {
5
+ abstract can(statement: JsonStatement, dialect: Dialect): boolean;
6
+ abstract convert(statement: JsonStatement): string;
7
+ }
8
+ export declare class SQLiteCreateTableConvertor extends Convertor {
9
+ can(statement: JsonStatement, dialect: Dialect): boolean;
10
+ convert(st: JsonSqliteCreateTableStatement): string;
11
+ }
12
+ export declare class SQLiteDropTableConvertor extends Convertor {
13
+ can(statement: JsonStatement, dialect: Dialect): boolean;
14
+ convert(statement: JsonDropTableStatement): string;
15
+ }
16
+ export declare class SqliteRenameTableConvertor extends Convertor {
17
+ can(statement: JsonStatement, dialect: Dialect): boolean;
18
+ convert(statement: JsonRenameTableStatement): string;
19
+ }
20
+ export declare class SQLiteAlterTableAddColumnConvertor extends Convertor {
21
+ can(statement: JsonStatement, dialect: Dialect): boolean;
22
+ convert(statement: JsonSqliteAddColumnStatement): string;
23
+ }
24
+ export declare class CreateSqliteIndexConvertor extends Convertor {
25
+ can(statement: JsonStatement, dialect: Dialect): boolean;
26
+ convert(statement: JsonCreateIndexStatement): string;
27
+ }
28
+ export declare class SqliteDropIndexConvertor extends Convertor {
29
+ can(statement: JsonStatement, dialect: Dialect): boolean;
30
+ convert(statement: JsonDropIndexStatement): string;
31
+ }
32
+ export declare const fromJson: (statements: JsonStatement[], dialect: Dialect) => string[];
33
+ export {};
@@ -0,0 +1,5 @@
1
+ import "./@types/utils";
2
+ import { ConfigIntrospectCasing } from "./cli/commands/utils";
3
+ import { SQLiteSchema } from "./serializer/sqliteSchema";
4
+ export declare const indexName: (tableName: string, columns: string[]) => string;
5
+ export declare const schemaToTypeScript: (schema: SQLiteSchema, casing: ConfigIntrospectCasing["casing"]) => string;
@@ -0,0 +1,7 @@
1
+ export declare const prepareMigrationMetadata: (idx: number) => {
2
+ prefix: string;
3
+ suffix: string;
4
+ tag: string;
5
+ };
6
+ export declare const adjectives: string[];
7
+ export declare const heroes: string[];
package/utils.d.ts ADDED
@@ -0,0 +1,236 @@
1
+ import { Dialect } from "./schemaValidator";
2
+ import { NamedWithSchema } from "./cli/commands/migrate";
3
+ import { AnyPgTable, PgDatabase } from "drizzle-orm/pg-core";
4
+ import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
5
+ import { Config, DbConnection } from ".";
6
+ export { toDrizzle as drizzleSchemaPg } from "./serializer/pgSerializer";
7
+ export { toDrizzle as drizzleSchemaSQLite } from "./serializer/sqliteSerializer";
8
+ export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
9
+ export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
10
+ export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
11
+ export type Journal = {
12
+ version: string;
13
+ dialect: Dialect;
14
+ entries: {
15
+ idx: number;
16
+ version: string;
17
+ when: number;
18
+ tag: string;
19
+ breakpoints: boolean;
20
+ }[];
21
+ };
22
+ export declare const dryJournal: (dialect: Dialect) => Journal;
23
+ export declare const snapshotsPriorV4: (out: string) => string[];
24
+ export declare function defineConfig(config: Config): Config;
25
+ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
26
+ meta: string;
27
+ snapshots: string[];
28
+ journal: any;
29
+ };
30
+ export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
31
+ export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
32
+ malformed: string[];
33
+ nonLatest: string[];
34
+ idsMap: Record<string, {
35
+ parent: string;
36
+ snapshots: string[];
37
+ }>;
38
+ rawMap: Record<string, any>;
39
+ };
40
+ export declare const prepareMigrationFolder: (outFolder: string | undefined, dialect: Dialect) => {
41
+ snapshots: string[];
42
+ journal: any;
43
+ };
44
+ export declare const prepareMigrationMeta: (schemas: {
45
+ from: string;
46
+ to: string;
47
+ }[], tables: {
48
+ from: NamedWithSchema;
49
+ to: NamedWithSchema;
50
+ }[], columns: {
51
+ from: {
52
+ table: string;
53
+ schema: string;
54
+ column: string;
55
+ };
56
+ to: {
57
+ table: string;
58
+ schema: string;
59
+ column: string;
60
+ };
61
+ }[]) => {
62
+ schemas: {};
63
+ tables: {};
64
+ columns: {};
65
+ };
66
+ export declare const schemaRenameKey: (it: string) => string;
67
+ export declare const tableRenameKey: (it: NamedWithSchema) => string;
68
+ export declare const columnRenameKey: (table: string, schema: string, column: string) => string;
69
+ export declare const kloudMeta: () => {
70
+ pg: number[];
71
+ mysql: number[];
72
+ sqlite: number[];
73
+ };
74
+ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
75
+ left: {
76
+ internal?: {
77
+ tables: Record<string, {
78
+ columns: Record<string, {
79
+ isArray?: boolean | undefined;
80
+ dimensions?: number | undefined;
81
+ rawType?: string | undefined;
82
+ } | undefined>;
83
+ } | undefined>;
84
+ } | undefined;
85
+ id: string;
86
+ prevId: string;
87
+ version: "5";
88
+ dialect: "pg";
89
+ tables: Record<string, {
90
+ name: string;
91
+ columns: Record<string, {
92
+ isUnique?: any;
93
+ default?: any;
94
+ uniqueName?: string | undefined;
95
+ nullsNotDistinct?: boolean | undefined;
96
+ name: string;
97
+ type: string;
98
+ primaryKey: boolean;
99
+ notNull: boolean;
100
+ }>;
101
+ indexes: Record<string, {
102
+ name: string;
103
+ columns: string[];
104
+ isUnique: boolean;
105
+ }>;
106
+ foreignKeys: Record<string, {
107
+ onUpdate?: string | undefined;
108
+ onDelete?: string | undefined;
109
+ name: string;
110
+ tableFrom: string;
111
+ columnsFrom: string[];
112
+ tableTo: string;
113
+ columnsTo: string[];
114
+ }>;
115
+ schema: string;
116
+ compositePrimaryKeys: Record<string, {
117
+ name: string;
118
+ columns: string[];
119
+ }>;
120
+ uniqueConstraints: Record<string, {
121
+ name: string;
122
+ columns: string[];
123
+ nullsNotDistinct: boolean;
124
+ }>;
125
+ }>;
126
+ schemas: Record<string, string>;
127
+ _meta: {
128
+ columns: Record<string, string>;
129
+ tables: Record<string, string>;
130
+ schemas: Record<string, string>;
131
+ };
132
+ enums: Record<string, {
133
+ name: string;
134
+ values: Record<string, string>;
135
+ }>;
136
+ };
137
+ right: {
138
+ internal?: {
139
+ tables: Record<string, {
140
+ columns: Record<string, {
141
+ isArray?: boolean | undefined;
142
+ dimensions?: number | undefined;
143
+ rawType?: string | undefined;
144
+ } | undefined>;
145
+ } | undefined>;
146
+ } | undefined;
147
+ id: string;
148
+ prevId: string;
149
+ version: "5";
150
+ dialect: "pg";
151
+ tables: Record<string, {
152
+ name: string;
153
+ columns: Record<string, {
154
+ isUnique?: any;
155
+ default?: any;
156
+ uniqueName?: string | undefined;
157
+ nullsNotDistinct?: boolean | undefined;
158
+ name: string;
159
+ type: string;
160
+ primaryKey: boolean;
161
+ notNull: boolean;
162
+ }>;
163
+ indexes: Record<string, {
164
+ name: string;
165
+ columns: string[];
166
+ isUnique: boolean;
167
+ }>;
168
+ foreignKeys: Record<string, {
169
+ onUpdate?: string | undefined;
170
+ onDelete?: string | undefined;
171
+ name: string;
172
+ tableFrom: string;
173
+ columnsFrom: string[];
174
+ tableTo: string;
175
+ columnsTo: string[];
176
+ }>;
177
+ schema: string;
178
+ compositePrimaryKeys: Record<string, {
179
+ name: string;
180
+ columns: string[];
181
+ }>;
182
+ uniqueConstraints: Record<string, {
183
+ name: string;
184
+ columns: string[];
185
+ nullsNotDistinct: boolean;
186
+ }>;
187
+ }>;
188
+ schemas: Record<string, string>;
189
+ _meta: {
190
+ columns: Record<string, string>;
191
+ tables: Record<string, string>;
192
+ schemas: Record<string, string>;
193
+ };
194
+ enums: Record<string, {
195
+ name: string;
196
+ values: Record<string, string>;
197
+ }>;
198
+ };
199
+ statements: import("./jsonStatements").JsonStatement[];
200
+ sqlStatements: string[];
201
+ _meta: {
202
+ schemas: {};
203
+ tables: {};
204
+ columns: {};
205
+ } | undefined;
206
+ }>;
207
+ export type DrizzleSnapshotJSON = PgSchemaKit;
208
+ export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
209
+ export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
210
+ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
211
+ hasDataLoss: boolean;
212
+ warnings: string[];
213
+ statementsToExecute: string[];
214
+ apply: () => Promise<void>;
215
+ }>;
216
+ export declare const prepareFrom: (connection: DbConnection) => Promise<{
217
+ db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
218
+ type: "pg";
219
+ schema: Record<string, AnyPgTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
220
+ } | {
221
+ db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
222
+ type: "mysql";
223
+ schema: Record<string, import("drizzle-orm/mysql-core").AnyMySqlTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
224
+ } | {
225
+ db: import("./orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
226
+ type: "sqlite";
227
+ schema: Record<string, import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | import("drizzle-orm/sqlite-core").AnySQLiteTable<{}>> | undefined;
228
+ } | {
229
+ db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
230
+ type: "sqlite";
231
+ schema: Record<string, import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | import("drizzle-orm/sqlite-core").AnySQLiteTable<{}>> | undefined;
232
+ } | {
233
+ db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
234
+ type: "sqlite";
235
+ schema: Record<string, import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | import("drizzle-orm/sqlite-core").AnySQLiteTable<{}>> | undefined;
236
+ }>;