drizzle-kit 0.20.0-5198fb7 → 0.20.0-588929f

Sign up to get free protection for your applications and to get access to all the features.
package/utils.d.ts CHANGED
@@ -1,11 +1,206 @@
1
- import { AnyMySqlTable } from "drizzle-orm/mysql-core";
2
- import { Relations } from "drizzle-orm";
3
- import { AnyPgTable, PgDatabase } from "drizzle-orm/pg-core";
4
- import { Config, DbConnection } from ".";
5
- import { PgSchema } from "./serializer/pgSchema";
6
- import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
7
- export type DrizzleSnapshotJSON = PgSchema;
8
- export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => DrizzleSnapshotJSON;
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;
9
204
  export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
10
205
  export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
11
206
  hasDataLoss: boolean;
@@ -13,21 +208,4 @@ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDataba
13
208
  statementsToExecute: string[];
14
209
  apply: () => Promise<void>;
15
210
  }>;
16
- export declare const prepareFrom: (connection: DbConnection) => Promise<{
17
- db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
18
- type: "pg";
19
- schema: Record<string, AnyPgTable<{}> | Relations>;
20
- } | {
21
- db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
22
- type: "mysql2";
23
- schema: Record<string, AnyMySqlTable<{}> | Relations>;
24
- } | {
25
- db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
26
- type: "sqlite";
27
- schema: Record<string, AnySQLiteTable<{}> | Relations>;
28
- } | {
29
- db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
30
- type: "sqlite";
31
- schema: Record<string, AnySQLiteTable<{}> | Relations>;
32
- }>;
33
- export declare function defineConfig(config: Config): Config;
211
+ export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;