@nextlyhq/adapter-drizzle 0.0.2-alpha.7 → 0.0.2-alpha.70
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/README.md +25 -1
- package/dist/adapter-BypoOEEN.d.cts +1166 -0
- package/dist/adapter-CSP-Ek-L.d.ts +1166 -0
- package/dist/index-BYb6cDli.d.ts +1168 -0
- package/dist/index-C4HJsfwA.d.cts +1168 -0
- package/dist/index.cjs +2302 -1085
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.mjs +2301 -1083
- package/dist/index.mjs.map +1 -1
- package/dist/migrations.cjs +345 -146
- package/dist/migrations.cjs.map +1 -1
- package/dist/migrations.d.cts +93 -109
- package/dist/migrations.d.ts +93 -109
- package/dist/migrations.mjs +344 -144
- package/dist/migrations.mjs.map +1 -1
- package/dist/schema/index.cjs +21 -6
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +5 -116
- package/dist/schema/index.d.ts +5 -116
- package/dist/schema/index.mjs +20 -4
- package/dist/schema/index.mjs.map +1 -1
- package/dist/schema-Bkkr3JMC.d.cts +264 -0
- package/dist/schema-Bkkr3JMC.d.ts +264 -0
- package/dist/schema-name.cjs +42 -0
- package/dist/schema-name.cjs.map +1 -0
- package/dist/schema-name.d.cts +12 -0
- package/dist/schema-name.d.ts +12 -0
- package/dist/schema-name.mjs +40 -0
- package/dist/schema-name.mjs.map +1 -0
- package/dist/text-match.cjs +50 -0
- package/dist/text-match.cjs.map +1 -0
- package/dist/text-match.d.cts +32 -0
- package/dist/text-match.d.ts +32 -0
- package/dist/text-match.mjs +48 -0
- package/dist/text-match.mjs.map +1 -0
- package/dist/types/index.cjs +8 -24
- package/dist/types/index.d.cts +3 -210
- package/dist/types/index.d.ts +3 -210
- package/dist/types/index.mjs +1 -21
- package/dist/types-CNyA1oIm.cjs +185 -0
- package/dist/types-CNyA1oIm.cjs.map +1 -0
- package/dist/types-CaF_5jNk.mjs +150 -0
- package/dist/types-CaF_5jNk.mjs.map +1 -0
- package/dist/version-check.cjs +119 -127
- package/dist/version-check.cjs.map +1 -1
- package/dist/version-check.d.cts +54 -39
- package/dist/version-check.d.ts +54 -39
- package/dist/version-check.mjs +117 -125
- package/dist/version-check.mjs.map +1 -1
- package/package.json +23 -17
- package/dist/adapter-BxJVtttb.d.ts +0 -592
- package/dist/adapter-nvlxFkF-.d.cts +0 -592
- package/dist/core-CVO7WYDj.d.cts +0 -74
- package/dist/core-CVO7WYDj.d.ts +0 -74
- package/dist/error-um1d_3Uo.d.cts +0 -105
- package/dist/error-um1d_3Uo.d.ts +0 -105
- package/dist/migration-BbO5meEV.d.cts +0 -622
- package/dist/migration-Qe70wDOC.d.ts +0 -622
- package/dist/schema-BDn8WfSL.d.cts +0 -200
- package/dist/schema-BIQ0YQZ_.d.ts +0 -200
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.mjs.map +0 -1
package/dist/migrations.d.cts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { d as MigrationResult } from './migration-BbO5meEV.cjs';
|
|
4
|
-
import './core-CVO7WYDj.cjs';
|
|
5
|
-
import './schema-BDn8WfSL.cjs';
|
|
6
|
-
import './error-um1d_3Uo.cjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Database migration utilities.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Provides core utilities for migration management including checksum calculation,
|
|
13
|
-
* sorting, filtering, and validation. Also includes optional helpers for adapters
|
|
14
|
-
* to use for common migration operations.
|
|
15
|
-
*
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
|
|
1
|
+
import { t as DrizzleAdapter } from "./adapter-BypoOEEN.cjs";
|
|
2
|
+
import { _ as MigrationOptions, b as MigrationStatus, g as Migration, v as MigrationRecord, y as MigrationResult } from "./index-C4HJsfwA.cjs";
|
|
19
3
|
/**
|
|
20
4
|
* Calculate SHA-256 checksum for a migration.
|
|
21
5
|
*
|
|
@@ -42,7 +26,7 @@ import './error-um1d_3Uo.cjs';
|
|
|
42
26
|
*
|
|
43
27
|
* @public
|
|
44
28
|
*/
|
|
45
|
-
declare function calculateChecksum(migration: Migration): string;
|
|
29
|
+
export declare function calculateChecksum(migration: Migration): string;
|
|
46
30
|
/**
|
|
47
31
|
* Sort migrations by timestamp in ascending order.
|
|
48
32
|
*
|
|
@@ -67,7 +51,7 @@ declare function calculateChecksum(migration: Migration): string;
|
|
|
67
51
|
*
|
|
68
52
|
* @public
|
|
69
53
|
*/
|
|
70
|
-
declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
54
|
+
export declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
71
55
|
/**
|
|
72
56
|
* Filter migrations to get only pending (unapplied) migrations.
|
|
73
57
|
*
|
|
@@ -98,7 +82,7 @@ declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
|
98
82
|
*
|
|
99
83
|
* @public
|
|
100
84
|
*/
|
|
101
|
-
declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
85
|
+
export declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
102
86
|
/**
|
|
103
87
|
* Filter migration records to get only those that match given migrations.
|
|
104
88
|
*
|
|
@@ -130,7 +114,7 @@ declare function filterPending(migrations: Migration[], applied: MigrationRecord
|
|
|
130
114
|
*
|
|
131
115
|
* @public
|
|
132
116
|
*/
|
|
133
|
-
declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
117
|
+
export declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
134
118
|
/**
|
|
135
119
|
* Validate that a migration's checksum matches its applied record.
|
|
136
120
|
*
|
|
@@ -158,7 +142,7 @@ declare function filterApplied(migrations: Migration[], applied: MigrationRecord
|
|
|
158
142
|
*
|
|
159
143
|
* @public
|
|
160
144
|
*/
|
|
161
|
-
declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
145
|
+
export declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
162
146
|
/**
|
|
163
147
|
* Detect migrations that have been modified after being applied.
|
|
164
148
|
*
|
|
@@ -185,7 +169,7 @@ declare function validateChecksum(migration: Migration, record: MigrationRecord)
|
|
|
185
169
|
*
|
|
186
170
|
* @public
|
|
187
171
|
*/
|
|
188
|
-
declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
172
|
+
export declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
189
173
|
/**
|
|
190
174
|
* Get comprehensive migration status.
|
|
191
175
|
*
|
|
@@ -206,23 +190,23 @@ declare function detectModified(migrations: Migration[], applied: MigrationRecor
|
|
|
206
190
|
*
|
|
207
191
|
* @public
|
|
208
192
|
*/
|
|
209
|
-
declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
193
|
+
export declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
210
194
|
/**
|
|
211
195
|
* Validation result for migrations.
|
|
212
196
|
*
|
|
213
197
|
* @public
|
|
214
198
|
*/
|
|
215
|
-
interface MigrationValidationResult {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
199
|
+
export interface MigrationValidationResult {
|
|
200
|
+
/** Whether all validations passed */
|
|
201
|
+
valid: boolean;
|
|
202
|
+
/** List of validation errors */
|
|
203
|
+
errors: string[];
|
|
204
|
+
/** List of validation warnings */
|
|
205
|
+
warnings: string[];
|
|
206
|
+
/** Migrations that have been modified */
|
|
207
|
+
modified: MigrationRecord[];
|
|
208
|
+
/** Duplicate migration IDs found */
|
|
209
|
+
duplicates: string[];
|
|
226
210
|
}
|
|
227
211
|
/**
|
|
228
212
|
* Validate migrations for common issues.
|
|
@@ -253,7 +237,7 @@ interface MigrationValidationResult {
|
|
|
253
237
|
*
|
|
254
238
|
* @public
|
|
255
239
|
*/
|
|
256
|
-
declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
240
|
+
export declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
257
241
|
/**
|
|
258
242
|
* Helper functions for managing migrations in database adapters.
|
|
259
243
|
*
|
|
@@ -266,75 +250,75 @@ declare function validateMigrations(migrations: Migration[], applied: MigrationR
|
|
|
266
250
|
*
|
|
267
251
|
* @public
|
|
268
252
|
*/
|
|
269
|
-
interface MigrationHelpers {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
253
|
+
export interface MigrationHelpers {
|
|
254
|
+
/**
|
|
255
|
+
* Create the migrations tracking table if it doesn't exist.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* Creates a table named `nextly_migrations` with columns:
|
|
259
|
+
* - id (string, primary key)
|
|
260
|
+
* - name (string)
|
|
261
|
+
* - applied_at (timestamp)
|
|
262
|
+
* - checksum (string, optional)
|
|
263
|
+
*
|
|
264
|
+
* Uses CREATE TABLE IF NOT EXISTS for safety.
|
|
265
|
+
*
|
|
266
|
+
* @param adapter - Database adapter to use
|
|
267
|
+
* @returns Promise that resolves when table is created
|
|
268
|
+
*/
|
|
269
|
+
createMigrationsTable(adapter: DrizzleAdapter): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Get all applied migration records from the database.
|
|
272
|
+
*
|
|
273
|
+
* @remarks
|
|
274
|
+
* Queries the `nextly_migrations` table and returns all records
|
|
275
|
+
* sorted by applied_at descending (most recent first).
|
|
276
|
+
*
|
|
277
|
+
* @param adapter - Database adapter to use
|
|
278
|
+
* @returns Promise with array of applied migration records
|
|
279
|
+
*/
|
|
280
|
+
getAppliedMigrations(adapter: DrizzleAdapter): Promise<MigrationRecord[]>;
|
|
281
|
+
/**
|
|
282
|
+
* Record a migration as applied in the database.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Inserts a new record into the `nextly_migrations` table with:
|
|
286
|
+
* - Migration ID, name
|
|
287
|
+
* - Current timestamp for applied_at
|
|
288
|
+
* - Calculated checksum
|
|
289
|
+
*
|
|
290
|
+
* Should be called within a transaction during migration execution.
|
|
291
|
+
*
|
|
292
|
+
* @param adapter - Database adapter to use
|
|
293
|
+
* @param migration - Migration that was applied
|
|
294
|
+
* @returns Promise that resolves when record is inserted
|
|
295
|
+
*/
|
|
296
|
+
recordMigration(adapter: DrizzleAdapter, migration: Migration): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Remove a migration record from the database.
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* Deletes a record from the `nextly_migrations` table.
|
|
302
|
+
* Used during migration rollback operations.
|
|
303
|
+
*
|
|
304
|
+
* Should be called within a transaction during rollback.
|
|
305
|
+
*
|
|
306
|
+
* @param adapter - Database adapter to use
|
|
307
|
+
* @param migrationId - ID of the migration to remove
|
|
308
|
+
* @returns Promise that resolves when record is deleted
|
|
309
|
+
*/
|
|
310
|
+
removeMigrationRecord(adapter: DrizzleAdapter, migrationId: string): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Check if migrations table exists.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* Queries database metadata to check if the `nextly_migrations` table exists.
|
|
316
|
+
* Useful for determining if initialization is needed.
|
|
317
|
+
*
|
|
318
|
+
* @param adapter - Database adapter to use
|
|
319
|
+
* @returns Promise with boolean indicating if table exists
|
|
320
|
+
*/
|
|
321
|
+
migrationsTableExists(adapter: DrizzleAdapter): Promise<boolean>;
|
|
338
322
|
}
|
|
339
323
|
/**
|
|
340
324
|
* Implementation of migration helpers.
|
|
@@ -346,6 +330,6 @@ interface MigrationHelpers {
|
|
|
346
330
|
*
|
|
347
331
|
* @public
|
|
348
332
|
*/
|
|
349
|
-
declare const migrationHelpers: MigrationHelpers;
|
|
350
|
-
|
|
351
|
-
|
|
333
|
+
export declare const migrationHelpers: MigrationHelpers;
|
|
334
|
+
export type { Migration, MigrationOptions, MigrationRecord, MigrationResult, MigrationStatus };
|
|
335
|
+
//# sourceMappingURL=migrations.d.cts.map
|
package/dist/migrations.d.ts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { d as MigrationResult } from './migration-Qe70wDOC.js';
|
|
4
|
-
import './core-CVO7WYDj.js';
|
|
5
|
-
import './schema-BIQ0YQZ_.js';
|
|
6
|
-
import './error-um1d_3Uo.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Database migration utilities.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Provides core utilities for migration management including checksum calculation,
|
|
13
|
-
* sorting, filtering, and validation. Also includes optional helpers for adapters
|
|
14
|
-
* to use for common migration operations.
|
|
15
|
-
*
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
|
|
1
|
+
import { t as DrizzleAdapter } from "./adapter-CSP-Ek-L.js";
|
|
2
|
+
import { _ as MigrationOptions, b as MigrationStatus, g as Migration, v as MigrationRecord, y as MigrationResult } from "./index-BYb6cDli.js";
|
|
19
3
|
/**
|
|
20
4
|
* Calculate SHA-256 checksum for a migration.
|
|
21
5
|
*
|
|
@@ -42,7 +26,7 @@ import './error-um1d_3Uo.js';
|
|
|
42
26
|
*
|
|
43
27
|
* @public
|
|
44
28
|
*/
|
|
45
|
-
declare function calculateChecksum(migration: Migration): string;
|
|
29
|
+
export declare function calculateChecksum(migration: Migration): string;
|
|
46
30
|
/**
|
|
47
31
|
* Sort migrations by timestamp in ascending order.
|
|
48
32
|
*
|
|
@@ -67,7 +51,7 @@ declare function calculateChecksum(migration: Migration): string;
|
|
|
67
51
|
*
|
|
68
52
|
* @public
|
|
69
53
|
*/
|
|
70
|
-
declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
54
|
+
export declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
71
55
|
/**
|
|
72
56
|
* Filter migrations to get only pending (unapplied) migrations.
|
|
73
57
|
*
|
|
@@ -98,7 +82,7 @@ declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
|
98
82
|
*
|
|
99
83
|
* @public
|
|
100
84
|
*/
|
|
101
|
-
declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
85
|
+
export declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
102
86
|
/**
|
|
103
87
|
* Filter migration records to get only those that match given migrations.
|
|
104
88
|
*
|
|
@@ -130,7 +114,7 @@ declare function filterPending(migrations: Migration[], applied: MigrationRecord
|
|
|
130
114
|
*
|
|
131
115
|
* @public
|
|
132
116
|
*/
|
|
133
|
-
declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
117
|
+
export declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
134
118
|
/**
|
|
135
119
|
* Validate that a migration's checksum matches its applied record.
|
|
136
120
|
*
|
|
@@ -158,7 +142,7 @@ declare function filterApplied(migrations: Migration[], applied: MigrationRecord
|
|
|
158
142
|
*
|
|
159
143
|
* @public
|
|
160
144
|
*/
|
|
161
|
-
declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
145
|
+
export declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
162
146
|
/**
|
|
163
147
|
* Detect migrations that have been modified after being applied.
|
|
164
148
|
*
|
|
@@ -185,7 +169,7 @@ declare function validateChecksum(migration: Migration, record: MigrationRecord)
|
|
|
185
169
|
*
|
|
186
170
|
* @public
|
|
187
171
|
*/
|
|
188
|
-
declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
172
|
+
export declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
189
173
|
/**
|
|
190
174
|
* Get comprehensive migration status.
|
|
191
175
|
*
|
|
@@ -206,23 +190,23 @@ declare function detectModified(migrations: Migration[], applied: MigrationRecor
|
|
|
206
190
|
*
|
|
207
191
|
* @public
|
|
208
192
|
*/
|
|
209
|
-
declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
193
|
+
export declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
210
194
|
/**
|
|
211
195
|
* Validation result for migrations.
|
|
212
196
|
*
|
|
213
197
|
* @public
|
|
214
198
|
*/
|
|
215
|
-
interface MigrationValidationResult {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
199
|
+
export interface MigrationValidationResult {
|
|
200
|
+
/** Whether all validations passed */
|
|
201
|
+
valid: boolean;
|
|
202
|
+
/** List of validation errors */
|
|
203
|
+
errors: string[];
|
|
204
|
+
/** List of validation warnings */
|
|
205
|
+
warnings: string[];
|
|
206
|
+
/** Migrations that have been modified */
|
|
207
|
+
modified: MigrationRecord[];
|
|
208
|
+
/** Duplicate migration IDs found */
|
|
209
|
+
duplicates: string[];
|
|
226
210
|
}
|
|
227
211
|
/**
|
|
228
212
|
* Validate migrations for common issues.
|
|
@@ -253,7 +237,7 @@ interface MigrationValidationResult {
|
|
|
253
237
|
*
|
|
254
238
|
* @public
|
|
255
239
|
*/
|
|
256
|
-
declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
240
|
+
export declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
257
241
|
/**
|
|
258
242
|
* Helper functions for managing migrations in database adapters.
|
|
259
243
|
*
|
|
@@ -266,75 +250,75 @@ declare function validateMigrations(migrations: Migration[], applied: MigrationR
|
|
|
266
250
|
*
|
|
267
251
|
* @public
|
|
268
252
|
*/
|
|
269
|
-
interface MigrationHelpers {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
253
|
+
export interface MigrationHelpers {
|
|
254
|
+
/**
|
|
255
|
+
* Create the migrations tracking table if it doesn't exist.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* Creates a table named `nextly_migrations` with columns:
|
|
259
|
+
* - id (string, primary key)
|
|
260
|
+
* - name (string)
|
|
261
|
+
* - applied_at (timestamp)
|
|
262
|
+
* - checksum (string, optional)
|
|
263
|
+
*
|
|
264
|
+
* Uses CREATE TABLE IF NOT EXISTS for safety.
|
|
265
|
+
*
|
|
266
|
+
* @param adapter - Database adapter to use
|
|
267
|
+
* @returns Promise that resolves when table is created
|
|
268
|
+
*/
|
|
269
|
+
createMigrationsTable(adapter: DrizzleAdapter): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Get all applied migration records from the database.
|
|
272
|
+
*
|
|
273
|
+
* @remarks
|
|
274
|
+
* Queries the `nextly_migrations` table and returns all records
|
|
275
|
+
* sorted by applied_at descending (most recent first).
|
|
276
|
+
*
|
|
277
|
+
* @param adapter - Database adapter to use
|
|
278
|
+
* @returns Promise with array of applied migration records
|
|
279
|
+
*/
|
|
280
|
+
getAppliedMigrations(adapter: DrizzleAdapter): Promise<MigrationRecord[]>;
|
|
281
|
+
/**
|
|
282
|
+
* Record a migration as applied in the database.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Inserts a new record into the `nextly_migrations` table with:
|
|
286
|
+
* - Migration ID, name
|
|
287
|
+
* - Current timestamp for applied_at
|
|
288
|
+
* - Calculated checksum
|
|
289
|
+
*
|
|
290
|
+
* Should be called within a transaction during migration execution.
|
|
291
|
+
*
|
|
292
|
+
* @param adapter - Database adapter to use
|
|
293
|
+
* @param migration - Migration that was applied
|
|
294
|
+
* @returns Promise that resolves when record is inserted
|
|
295
|
+
*/
|
|
296
|
+
recordMigration(adapter: DrizzleAdapter, migration: Migration): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Remove a migration record from the database.
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* Deletes a record from the `nextly_migrations` table.
|
|
302
|
+
* Used during migration rollback operations.
|
|
303
|
+
*
|
|
304
|
+
* Should be called within a transaction during rollback.
|
|
305
|
+
*
|
|
306
|
+
* @param adapter - Database adapter to use
|
|
307
|
+
* @param migrationId - ID of the migration to remove
|
|
308
|
+
* @returns Promise that resolves when record is deleted
|
|
309
|
+
*/
|
|
310
|
+
removeMigrationRecord(adapter: DrizzleAdapter, migrationId: string): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Check if migrations table exists.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* Queries database metadata to check if the `nextly_migrations` table exists.
|
|
316
|
+
* Useful for determining if initialization is needed.
|
|
317
|
+
*
|
|
318
|
+
* @param adapter - Database adapter to use
|
|
319
|
+
* @returns Promise with boolean indicating if table exists
|
|
320
|
+
*/
|
|
321
|
+
migrationsTableExists(adapter: DrizzleAdapter): Promise<boolean>;
|
|
338
322
|
}
|
|
339
323
|
/**
|
|
340
324
|
* Implementation of migration helpers.
|
|
@@ -346,6 +330,6 @@ interface MigrationHelpers {
|
|
|
346
330
|
*
|
|
347
331
|
* @public
|
|
348
332
|
*/
|
|
349
|
-
declare const migrationHelpers: MigrationHelpers;
|
|
350
|
-
|
|
351
|
-
|
|
333
|
+
export declare const migrationHelpers: MigrationHelpers;
|
|
334
|
+
export type { Migration, MigrationOptions, MigrationRecord, MigrationResult, MigrationStatus };
|
|
335
|
+
//# sourceMappingURL=migrations.d.ts.map
|