@nextlyhq/adapter-drizzle 0.0.2-alpha.67 → 0.0.2-alpha.69
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/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 +2258 -2183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -10
- package/dist/index.d.ts +5 -10
- package/dist/index.mjs +2257 -2181
- 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 -110
- package/dist/migrations.d.ts +93 -110
- 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 +34 -12
- package/dist/schema-name.cjs.map +1 -1
- package/dist/schema-name.d.cts +3 -15
- package/dist/schema-name.d.ts +3 -15
- package/dist/schema-name.mjs +33 -10
- package/dist/schema-name.mjs.map +1 -1
- package/dist/text-match.cjs +42 -8
- package/dist/text-match.cjs.map +1 -1
- package/dist/text-match.d.cts +4 -16
- package/dist/text-match.d.ts +4 -16
- package/dist/text-match.mjs +41 -6
- package/dist/text-match.mjs.map +1 -1
- package/dist/types/index.cjs +8 -69
- package/dist/types/index.d.cts +3 -225
- package/dist/types/index.d.ts +3 -225
- package/dist/types/index.mjs +1 -64
- 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 +116 -133
- package/dist/version-check.cjs.map +1 -1
- package/dist/version-check.d.cts +46 -47
- package/dist/version-check.d.ts +46 -47
- package/dist/version-check.mjs +115 -131
- package/dist/version-check.mjs.map +1 -1
- package/package.json +12 -16
- package/dist/adapter-bUAaPzjV.d.cts +0 -1143
- package/dist/adapter-iJ5hbUvL.d.ts +0 -1143
- package/dist/core-CVO7WYDj.d.cts +0 -74
- package/dist/core-CVO7WYDj.d.ts +0 -74
- package/dist/error-BrdknH2s.d.cts +0 -122
- package/dist/error-BrdknH2s.d.ts +0 -122
- package/dist/migration-BqHebSwM.d.ts +0 -831
- package/dist/migration-Bu0WLdX4.d.cts +0 -831
- 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,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { d as MigrationResult } from './migration-Bu0WLdX4.cjs';
|
|
4
|
-
import 'drizzle-orm';
|
|
5
|
-
import './core-CVO7WYDj.cjs';
|
|
6
|
-
import './schema-BDn8WfSL.cjs';
|
|
7
|
-
import './error-BrdknH2s.cjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Database migration utilities.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Provides core utilities for migration management including checksum calculation,
|
|
14
|
-
* sorting, filtering, and validation. Also includes optional helpers for adapters
|
|
15
|
-
* to use for common migration operations.
|
|
16
|
-
*
|
|
17
|
-
* @packageDocumentation
|
|
18
|
-
*/
|
|
19
|
-
|
|
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";
|
|
20
3
|
/**
|
|
21
4
|
* Calculate SHA-256 checksum for a migration.
|
|
22
5
|
*
|
|
@@ -43,7 +26,7 @@ import './error-BrdknH2s.cjs';
|
|
|
43
26
|
*
|
|
44
27
|
* @public
|
|
45
28
|
*/
|
|
46
|
-
declare function calculateChecksum(migration: Migration): string;
|
|
29
|
+
export declare function calculateChecksum(migration: Migration): string;
|
|
47
30
|
/**
|
|
48
31
|
* Sort migrations by timestamp in ascending order.
|
|
49
32
|
*
|
|
@@ -68,7 +51,7 @@ declare function calculateChecksum(migration: Migration): string;
|
|
|
68
51
|
*
|
|
69
52
|
* @public
|
|
70
53
|
*/
|
|
71
|
-
declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
54
|
+
export declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
72
55
|
/**
|
|
73
56
|
* Filter migrations to get only pending (unapplied) migrations.
|
|
74
57
|
*
|
|
@@ -99,7 +82,7 @@ declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
|
99
82
|
*
|
|
100
83
|
* @public
|
|
101
84
|
*/
|
|
102
|
-
declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
85
|
+
export declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
103
86
|
/**
|
|
104
87
|
* Filter migration records to get only those that match given migrations.
|
|
105
88
|
*
|
|
@@ -131,7 +114,7 @@ declare function filterPending(migrations: Migration[], applied: MigrationRecord
|
|
|
131
114
|
*
|
|
132
115
|
* @public
|
|
133
116
|
*/
|
|
134
|
-
declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
117
|
+
export declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
135
118
|
/**
|
|
136
119
|
* Validate that a migration's checksum matches its applied record.
|
|
137
120
|
*
|
|
@@ -159,7 +142,7 @@ declare function filterApplied(migrations: Migration[], applied: MigrationRecord
|
|
|
159
142
|
*
|
|
160
143
|
* @public
|
|
161
144
|
*/
|
|
162
|
-
declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
145
|
+
export declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
163
146
|
/**
|
|
164
147
|
* Detect migrations that have been modified after being applied.
|
|
165
148
|
*
|
|
@@ -186,7 +169,7 @@ declare function validateChecksum(migration: Migration, record: MigrationRecord)
|
|
|
186
169
|
*
|
|
187
170
|
* @public
|
|
188
171
|
*/
|
|
189
|
-
declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
172
|
+
export declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
190
173
|
/**
|
|
191
174
|
* Get comprehensive migration status.
|
|
192
175
|
*
|
|
@@ -207,23 +190,23 @@ declare function detectModified(migrations: Migration[], applied: MigrationRecor
|
|
|
207
190
|
*
|
|
208
191
|
* @public
|
|
209
192
|
*/
|
|
210
|
-
declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
193
|
+
export declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
211
194
|
/**
|
|
212
195
|
* Validation result for migrations.
|
|
213
196
|
*
|
|
214
197
|
* @public
|
|
215
198
|
*/
|
|
216
|
-
interface MigrationValidationResult {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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[];
|
|
227
210
|
}
|
|
228
211
|
/**
|
|
229
212
|
* Validate migrations for common issues.
|
|
@@ -254,7 +237,7 @@ interface MigrationValidationResult {
|
|
|
254
237
|
*
|
|
255
238
|
* @public
|
|
256
239
|
*/
|
|
257
|
-
declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
240
|
+
export declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
258
241
|
/**
|
|
259
242
|
* Helper functions for managing migrations in database adapters.
|
|
260
243
|
*
|
|
@@ -267,75 +250,75 @@ declare function validateMigrations(migrations: Migration[], applied: MigrationR
|
|
|
267
250
|
*
|
|
268
251
|
* @public
|
|
269
252
|
*/
|
|
270
|
-
interface MigrationHelpers {
|
|
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
|
-
|
|
338
|
-
|
|
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>;
|
|
339
322
|
}
|
|
340
323
|
/**
|
|
341
324
|
* Implementation of migration helpers.
|
|
@@ -347,6 +330,6 @@ interface MigrationHelpers {
|
|
|
347
330
|
*
|
|
348
331
|
* @public
|
|
349
332
|
*/
|
|
350
|
-
declare const migrationHelpers: MigrationHelpers;
|
|
351
|
-
|
|
352
|
-
|
|
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,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { d as MigrationResult } from './migration-BqHebSwM.js';
|
|
4
|
-
import 'drizzle-orm';
|
|
5
|
-
import './core-CVO7WYDj.js';
|
|
6
|
-
import './schema-BIQ0YQZ_.js';
|
|
7
|
-
import './error-BrdknH2s.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Database migration utilities.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Provides core utilities for migration management including checksum calculation,
|
|
14
|
-
* sorting, filtering, and validation. Also includes optional helpers for adapters
|
|
15
|
-
* to use for common migration operations.
|
|
16
|
-
*
|
|
17
|
-
* @packageDocumentation
|
|
18
|
-
*/
|
|
19
|
-
|
|
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";
|
|
20
3
|
/**
|
|
21
4
|
* Calculate SHA-256 checksum for a migration.
|
|
22
5
|
*
|
|
@@ -43,7 +26,7 @@ import './error-BrdknH2s.js';
|
|
|
43
26
|
*
|
|
44
27
|
* @public
|
|
45
28
|
*/
|
|
46
|
-
declare function calculateChecksum(migration: Migration): string;
|
|
29
|
+
export declare function calculateChecksum(migration: Migration): string;
|
|
47
30
|
/**
|
|
48
31
|
* Sort migrations by timestamp in ascending order.
|
|
49
32
|
*
|
|
@@ -68,7 +51,7 @@ declare function calculateChecksum(migration: Migration): string;
|
|
|
68
51
|
*
|
|
69
52
|
* @public
|
|
70
53
|
*/
|
|
71
|
-
declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
54
|
+
export declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
72
55
|
/**
|
|
73
56
|
* Filter migrations to get only pending (unapplied) migrations.
|
|
74
57
|
*
|
|
@@ -99,7 +82,7 @@ declare function sortMigrations(migrations: Migration[]): Migration[];
|
|
|
99
82
|
*
|
|
100
83
|
* @public
|
|
101
84
|
*/
|
|
102
|
-
declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
85
|
+
export declare function filterPending(migrations: Migration[], applied: MigrationRecord[]): Migration[];
|
|
103
86
|
/**
|
|
104
87
|
* Filter migration records to get only those that match given migrations.
|
|
105
88
|
*
|
|
@@ -131,7 +114,7 @@ declare function filterPending(migrations: Migration[], applied: MigrationRecord
|
|
|
131
114
|
*
|
|
132
115
|
* @public
|
|
133
116
|
*/
|
|
134
|
-
declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
117
|
+
export declare function filterApplied(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
135
118
|
/**
|
|
136
119
|
* Validate that a migration's checksum matches its applied record.
|
|
137
120
|
*
|
|
@@ -159,7 +142,7 @@ declare function filterApplied(migrations: Migration[], applied: MigrationRecord
|
|
|
159
142
|
*
|
|
160
143
|
* @public
|
|
161
144
|
*/
|
|
162
|
-
declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
145
|
+
export declare function validateChecksum(migration: Migration, record: MigrationRecord): boolean;
|
|
163
146
|
/**
|
|
164
147
|
* Detect migrations that have been modified after being applied.
|
|
165
148
|
*
|
|
@@ -186,7 +169,7 @@ declare function validateChecksum(migration: Migration, record: MigrationRecord)
|
|
|
186
169
|
*
|
|
187
170
|
* @public
|
|
188
171
|
*/
|
|
189
|
-
declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
172
|
+
export declare function detectModified(migrations: Migration[], applied: MigrationRecord[]): MigrationRecord[];
|
|
190
173
|
/**
|
|
191
174
|
* Get comprehensive migration status.
|
|
192
175
|
*
|
|
@@ -207,23 +190,23 @@ declare function detectModified(migrations: Migration[], applied: MigrationRecor
|
|
|
207
190
|
*
|
|
208
191
|
* @public
|
|
209
192
|
*/
|
|
210
|
-
declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
193
|
+
export declare function getMigrationStatus(migrations: Migration[], applied: MigrationRecord[]): MigrationStatus;
|
|
211
194
|
/**
|
|
212
195
|
* Validation result for migrations.
|
|
213
196
|
*
|
|
214
197
|
* @public
|
|
215
198
|
*/
|
|
216
|
-
interface MigrationValidationResult {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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[];
|
|
227
210
|
}
|
|
228
211
|
/**
|
|
229
212
|
* Validate migrations for common issues.
|
|
@@ -254,7 +237,7 @@ interface MigrationValidationResult {
|
|
|
254
237
|
*
|
|
255
238
|
* @public
|
|
256
239
|
*/
|
|
257
|
-
declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
240
|
+
export declare function validateMigrations(migrations: Migration[], applied: MigrationRecord[], options?: MigrationOptions): MigrationValidationResult;
|
|
258
241
|
/**
|
|
259
242
|
* Helper functions for managing migrations in database adapters.
|
|
260
243
|
*
|
|
@@ -267,75 +250,75 @@ declare function validateMigrations(migrations: Migration[], applied: MigrationR
|
|
|
267
250
|
*
|
|
268
251
|
* @public
|
|
269
252
|
*/
|
|
270
|
-
interface MigrationHelpers {
|
|
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
|
-
|
|
338
|
-
|
|
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>;
|
|
339
322
|
}
|
|
340
323
|
/**
|
|
341
324
|
* Implementation of migration helpers.
|
|
@@ -347,6 +330,6 @@ interface MigrationHelpers {
|
|
|
347
330
|
*
|
|
348
331
|
* @public
|
|
349
332
|
*/
|
|
350
|
-
declare const migrationHelpers: MigrationHelpers;
|
|
351
|
-
|
|
352
|
-
|
|
333
|
+
export declare const migrationHelpers: MigrationHelpers;
|
|
334
|
+
export type { Migration, MigrationOptions, MigrationRecord, MigrationResult, MigrationStatus };
|
|
335
|
+
//# sourceMappingURL=migrations.d.ts.map
|