drizzle-kit 0.20.0-f28522c → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
package/loader.mjs DELETED
@@ -1,57 +0,0 @@
1
- import esbuild from "esbuild";
2
- import * as path from "path";
3
- import { readFileSync } from "fs";
4
-
5
- const parse = (it) => {
6
- if (!it) return { drizzle: false };
7
-
8
- if (it.endsWith("__drizzle__")) {
9
- const offset = it.startsWith("file://") ? "file://".length : 0;
10
- const clean = it.slice(offset, -"__drizzle__".length);
11
- return { drizzle: true, clean, original: it };
12
- }
13
- return { drizzle: false, clean: it };
14
- };
15
-
16
- export function resolve(specifier, context, nextResolve) {
17
- const { drizzle, clean } = parse(specifier);
18
- if (drizzle && !clean.endsWith(".ts") && !clean.endsWith(".mts")) {
19
- return nextResolve(clean);
20
- }
21
-
22
- if (drizzle) {
23
- return {
24
- shortCircuit: true,
25
- url: `file://${specifier}`,
26
- };
27
- }
28
-
29
- const parsedParent = parse(context.parentURL);
30
- const parentURL = parsedParent.drizzle
31
- ? new URL(`file://${path.resolve(parsedParent.clean)}`)
32
- : context.parentURL;
33
-
34
- // Let Node.js handle all other specifiers.
35
- return nextResolve(specifier, { ...context, parentURL });
36
- }
37
-
38
- export async function load(url, context, defaultLoad) {
39
- const { drizzle, clean } = parse(url);
40
- if (drizzle) {
41
- const file = readFileSync(clean, "utf-8");
42
- if (clean.endsWith(".ts") || clean.endsWith(".mts")) {
43
- const source = esbuild.transformSync(file, {
44
- loader: "ts",
45
- format: "esm",
46
- });
47
- return {
48
- format: "module",
49
- shortCircuit: true,
50
- source: source.code,
51
- };
52
- }
53
- }
54
-
55
- // let Node.js handle all other URLs
56
- return defaultLoad(url, context, defaultLoad);
57
- }
package/utilsR.d.ts DELETED
@@ -1,232 +0,0 @@
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 "src";
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;
205
- export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
206
- export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
207
- hasDataLoss: boolean;
208
- warnings: string[];
209
- statementsToExecute: string[];
210
- apply: () => Promise<void>;
211
- }>;
212
- export declare const prepareFrom: (connection: DbConnection) => Promise<{
213
- db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, never>>;
214
- type: "pg";
215
- schema: Record<string, AnyPgTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
216
- } | {
217
- db: import("drizzle-orm/mysql2").MySql2Database<Record<string, never>>;
218
- type: "mysql";
219
- schema: Record<string, import("drizzle-orm/mysql-core").AnyMySqlTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
220
- } | {
221
- db: import("./orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
222
- type: "sqlite";
223
- schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
224
- } | {
225
- db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
226
- type: "sqlite";
227
- schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
228
- } | {
229
- db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
230
- type: "sqlite";
231
- schema: Record<string, import("drizzle-orm/sqlite-core").AnySQLiteTable<{}> | import("drizzle-orm").Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
232
- }>;