drizzle-kit 0.20.0-f28522c → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils.d.ts CHANGED
@@ -1,11 +1,207 @@
1
- import { AnyMySqlTable } from "drizzle-orm/mysql-core";
2
- import { Relations } from "drizzle-orm";
3
- import { AnyPgTable, PgDatabase } from "drizzle-orm/pg-core";
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";
4
5
  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;
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 function defineConfig(config: Config): Config;
21
+ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
22
+ meta: string;
23
+ snapshots: string[];
24
+ journal: any;
25
+ };
26
+ export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
27
+ export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
28
+ malformed: string[];
29
+ nonLatest: string[];
30
+ idsMap: Record<string, {
31
+ parent: string;
32
+ snapshots: string[];
33
+ }>;
34
+ rawMap: Record<string, any>;
35
+ };
36
+ export declare const prepareMigrationFolder: (outFolder: string | undefined, dialect: Dialect) => {
37
+ snapshots: string[];
38
+ journal: any;
39
+ };
40
+ export declare const prepareMigrationMeta: (schemas: {
41
+ from: string;
42
+ to: string;
43
+ }[], tables: {
44
+ from: NamedWithSchema;
45
+ to: NamedWithSchema;
46
+ }[], columns: {
47
+ from: {
48
+ table: string;
49
+ schema: string;
50
+ column: string;
51
+ };
52
+ to: {
53
+ table: string;
54
+ schema: string;
55
+ column: string;
56
+ };
57
+ }[]) => {
58
+ schemas: {};
59
+ tables: {};
60
+ columns: {};
61
+ };
62
+ export declare const schemaRenameKey: (it: string) => string;
63
+ export declare const tableRenameKey: (it: NamedWithSchema) => string;
64
+ export declare const columnRenameKey: (table: string, schema: string, column: string) => string;
65
+ export declare const kloudMeta: () => {
66
+ pg: number[];
67
+ mysql: number[];
68
+ sqlite: number[];
69
+ };
70
+ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
71
+ left: {
72
+ internal?: {
73
+ tables: Record<string, {
74
+ columns: Record<string, {
75
+ isArray?: boolean | undefined;
76
+ dimensions?: number | undefined;
77
+ rawType?: string | undefined;
78
+ } | undefined>;
79
+ } | undefined>;
80
+ } | undefined;
81
+ id: string;
82
+ prevId: string;
83
+ version: "5";
84
+ dialect: "pg";
85
+ tables: Record<string, {
86
+ name: string;
87
+ columns: Record<string, {
88
+ isUnique?: any;
89
+ default?: any;
90
+ uniqueName?: string | undefined;
91
+ nullsNotDistinct?: boolean | undefined;
92
+ name: string;
93
+ type: string;
94
+ primaryKey: boolean;
95
+ notNull: boolean;
96
+ }>;
97
+ indexes: Record<string, {
98
+ name: string;
99
+ columns: string[];
100
+ isUnique: boolean;
101
+ }>;
102
+ foreignKeys: Record<string, {
103
+ onUpdate?: string | undefined;
104
+ onDelete?: string | undefined;
105
+ name: string;
106
+ tableFrom: string;
107
+ columnsFrom: string[];
108
+ tableTo: string;
109
+ columnsTo: string[];
110
+ }>;
111
+ schema: string;
112
+ compositePrimaryKeys: Record<string, {
113
+ name: string;
114
+ columns: string[];
115
+ }>;
116
+ uniqueConstraints: Record<string, {
117
+ name: string;
118
+ columns: string[];
119
+ nullsNotDistinct: boolean;
120
+ }>;
121
+ }>;
122
+ schemas: Record<string, string>;
123
+ _meta: {
124
+ columns: Record<string, string>;
125
+ tables: Record<string, string>;
126
+ schemas: Record<string, string>;
127
+ };
128
+ enums: Record<string, {
129
+ name: string;
130
+ values: Record<string, string>;
131
+ }>;
132
+ };
133
+ right: {
134
+ internal?: {
135
+ tables: Record<string, {
136
+ columns: Record<string, {
137
+ isArray?: boolean | undefined;
138
+ dimensions?: number | undefined;
139
+ rawType?: string | undefined;
140
+ } | undefined>;
141
+ } | undefined>;
142
+ } | undefined;
143
+ id: string;
144
+ prevId: string;
145
+ version: "5";
146
+ dialect: "pg";
147
+ tables: Record<string, {
148
+ name: string;
149
+ columns: Record<string, {
150
+ isUnique?: any;
151
+ default?: any;
152
+ uniqueName?: string | undefined;
153
+ nullsNotDistinct?: boolean | undefined;
154
+ name: string;
155
+ type: string;
156
+ primaryKey: boolean;
157
+ notNull: boolean;
158
+ }>;
159
+ indexes: Record<string, {
160
+ name: string;
161
+ columns: string[];
162
+ isUnique: boolean;
163
+ }>;
164
+ foreignKeys: Record<string, {
165
+ onUpdate?: string | undefined;
166
+ onDelete?: string | undefined;
167
+ name: string;
168
+ tableFrom: string;
169
+ columnsFrom: string[];
170
+ tableTo: string;
171
+ columnsTo: string[];
172
+ }>;
173
+ schema: string;
174
+ compositePrimaryKeys: Record<string, {
175
+ name: string;
176
+ columns: string[];
177
+ }>;
178
+ uniqueConstraints: Record<string, {
179
+ name: string;
180
+ columns: string[];
181
+ nullsNotDistinct: boolean;
182
+ }>;
183
+ }>;
184
+ schemas: Record<string, string>;
185
+ _meta: {
186
+ columns: Record<string, string>;
187
+ tables: Record<string, string>;
188
+ schemas: Record<string, string>;
189
+ };
190
+ enums: Record<string, {
191
+ name: string;
192
+ values: Record<string, string>;
193
+ }>;
194
+ };
195
+ statements: import("./jsonStatements").JsonStatement[];
196
+ sqlStatements: string[];
197
+ _meta: {
198
+ schemas: {};
199
+ tables: {};
200
+ columns: {};
201
+ } | undefined;
202
+ }>;
203
+ export type DrizzleSnapshotJSON = PgSchemaKit;
204
+ export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
9
205
  export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
10
206
  export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
11
207
  hasDataLoss: boolean;
@@ -13,21 +209,4 @@ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDataba
13
209
  statementsToExecute: string[];
14
210
  apply: () => Promise<void>;
15
211
  }>;
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;
212
+ export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;