rake-db 2.25.17 → 2.27.2

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/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import * as orchid_core from 'orchid-core';
2
- import { MaybeArray, RawSQLBase, ColumnDataCheckBase, RecordString, ColumnTypeBase, EmptyObject, ColumnSchemaConfig, QueryLogObject, QueryLogOptions, MaybePromise, RecordOptionalString, ForeignKeyTable, SingleSql } from 'orchid-core';
2
+ import { MaybeArray, RawSQLBase, ColumnDataCheckBase, RecordString, ColumnTypeBase, EmptyObject, ColumnSchemaConfig, QueryLogOptions, AdapterBase, MaybePromise, QueryLogObject, QueryBase } from 'orchid-core';
3
3
  import * as pqb from 'pqb';
4
- import { TableData, ColumnsShape, NoPrimaryKeyOption, ColumnType, EnumColumn, raw, Adapter, DbResult, TransactionAdapter, TableDataFn, TableDataItem, DbDomainArg, Db, QueryArraysResult, AdapterOptions, DefaultColumnTypes, DefaultSchemaConfig, SearchWeight, ColumnsByType, DbStructureDomainsMap } from 'pqb';
4
+ import { ColumnsShape, Db, TableData, NoPrimaryKeyOption, ColumnType, EnumColumn, DefaultColumnTypes, DefaultSchemaConfig, DbResult, TableDataFn, TableDataItem, DbDomainArg, raw, SearchWeight, ColumnsByType, DbStructureDomainsMap } from 'pqb';
5
+
6
+ interface CreateTableResult<Table extends string, Shape extends ColumnsShape> {
7
+ table: Db<Table, Shape>;
8
+ }
5
9
 
6
10
  type RakeDbAst = RakeDbAst.Table | RakeDbAst.ChangeTable | RakeDbAst.RenameType | RakeDbAst.Schema | RakeDbAst.RenameSchema | RakeDbAst.Extension | RakeDbAst.Enum | RakeDbAst.EnumValues | RakeDbAst.RenameEnumValues | RakeDbAst.ChangeEnumValues | RakeDbAst.Domain | RakeDbAst.Collation | RakeDbAst.Constraint | RakeDbAst.RenameTableItem | RakeDbAst.View;
7
11
  declare namespace RakeDbAst {
@@ -266,6 +270,228 @@ declare const tableChangeMethods: {
266
270
  type TableChanger<CT> = MigrationColumnTypes<CT> & TableChangeMethods;
267
271
  type TableChangeData = Record<string, RakeDbAst.ChangeTableItem.Column | RakeDbAst.ChangeTableItem.Rename | Change | SpecialChange | ColumnTypeBase>;
268
272
 
273
+ interface RakeDbCtx {
274
+ migrationsPromise?: Promise<MigrationsSet>;
275
+ }
276
+ declare const getSchemaAndTableFromName: (name: string) => [string | undefined, string];
277
+ declare const concatSchemaAndName: ({ schema, name, }: {
278
+ schema?: string;
279
+ name: string;
280
+ }) => string;
281
+
282
+ interface MigrationItemHasLoad {
283
+ path?: string;
284
+ /**
285
+ * Function that loads the migration content,
286
+ * can store lazy import of a migration file.
287
+ * Promise can return `{ default: x }` where `x` is a return of `change` or an array of such returns.
288
+ */
289
+ load(): Promise<unknown>;
290
+ }
291
+ interface MigrationItem extends MigrationItemHasLoad {
292
+ path: string;
293
+ version: string;
294
+ }
295
+ interface MigrationsSet {
296
+ renameTo?: RakeDbRenameMigrations;
297
+ migrations: MigrationItem[];
298
+ }
299
+
300
+ interface CommandFn<SchemaConfig extends ColumnSchemaConfig, CT> {
301
+ (adapters: AdapterBase[], config: RakeDbConfig<SchemaConfig, CT>, args: string[]): void | Promise<void>;
302
+ }
303
+ interface PickBasePath {
304
+ basePath: string;
305
+ }
306
+ interface PickImport {
307
+ import(path: string): Promise<unknown>;
308
+ }
309
+ interface PickMigrationId {
310
+ migrationId: RakeDbMigrationId;
311
+ }
312
+ interface PickMigrations {
313
+ migrations?: ModuleExportsRecord;
314
+ }
315
+ interface PickMigrationsPath {
316
+ migrationsPath: string;
317
+ }
318
+ interface PickOptionalMigrationsPath {
319
+ migrationsPath?: string;
320
+ }
321
+ interface PickRenameMigrations {
322
+ renameMigrations?: RakeDbRenameMigrationsInput;
323
+ }
324
+ interface PickMigrationsTable {
325
+ migrationsTable: string;
326
+ }
327
+ interface PickMigrationCallbacks {
328
+ beforeChange?: ChangeCallback$1;
329
+ afterChange?: ChangeCallback$1;
330
+ beforeMigrate?: MigrationCallback;
331
+ afterMigrate?: MigrationCallback;
332
+ beforeRollback?: MigrationCallback;
333
+ afterRollback?: MigrationCallback;
334
+ }
335
+ interface PickAfterChangeCommit {
336
+ afterChangeCommit?: ChangeCommitCallback;
337
+ }
338
+ interface PickForceDefaultExports {
339
+ forceDefaultExports?: boolean;
340
+ }
341
+ interface RakeDbBaseConfig<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>> extends QueryLogOptions, PickImport, PickMigrationId, PickMigrationsPath, PickMigrations, PickRenameMigrations, PickMigrationsTable, PickMigrationCallbacks, PickForceDefaultExports, PickAfterChangeCommit {
342
+ schemaConfig: SchemaConfig;
343
+ snakeCase: boolean;
344
+ language?: string;
345
+ commands: Record<string, CommandFn<SchemaConfig, CT>>;
346
+ noPrimaryKey?: NoPrimaryKeyOption;
347
+ baseTable?: RakeDbBaseTable<CT>;
348
+ }
349
+ interface RakeDbConfig<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>> extends RakeDbBaseConfig<SchemaConfig, CT>, PickBasePath {
350
+ columnTypes: CT;
351
+ dbScript: string;
352
+ recurrentPath: string;
353
+ }
354
+ interface InputRakeDbConfigBase<SchemaConfig extends ColumnSchemaConfig, CT> extends QueryLogOptions, PickOptionalMigrationsPath {
355
+ columnTypes?: CT | ((t: DefaultColumnTypes<DefaultSchemaConfig>) => CT);
356
+ baseTable?: RakeDbBaseTable<CT>;
357
+ schemaConfig?: SchemaConfig;
358
+ basePath?: string;
359
+ dbScript?: string;
360
+ migrationId?: 'serial' | RakeDbMigrationId;
361
+ recurrentPath?: string;
362
+ migrationsTable?: string;
363
+ snakeCase?: boolean;
364
+ language?: string;
365
+ commands?: Record<string, (adapter: AdapterBase[], config: RakeDbConfig<SchemaConfig, CT>, args: string[]) => void | Promise<void>>;
366
+ noPrimaryKey?: NoPrimaryKeyOption;
367
+ forceDefaultExports?: boolean;
368
+ /**
369
+ * Is called once per db before migrating or rolling back a set of migrations.
370
+ *
371
+ * @param arg.db - query builder
372
+ * @param arg.up - whether it's migrating up or down
373
+ * @param arg.redo - whether it's migrating down and then up for `redo` command
374
+ * @param arg.migrations - array of executed (up or down) migrations
375
+ */
376
+ beforeChange?: ChangeCallback$1;
377
+ /**
378
+ * Is called once per db after migrating or rolling back a set of migrations.
379
+ * Runs inside the same transaction as migrations,
380
+ * for running after commit use {@link afterChangeCommit}.
381
+ *
382
+ * @param arg.db - query builder
383
+ * @param arg.up - whether it's migrating up or down
384
+ * @param arg.redo - whether it's migrating down and then up for `redo` command
385
+ * @param arg.migrations - array of executed (up or down) migrations
386
+ */
387
+ afterChange?: ChangeCallback$1;
388
+ /**
389
+ * Is called once per db after migrating or rolling back a set of migrations.
390
+ * Runs **after** committing migrations transaction.
391
+ *
392
+ * @param arg.options - database connection options
393
+ * @param arg.up - whether it's migrating up or down
394
+ * @param arg.migrations - array of executed (up or down) migrations
395
+ */
396
+ afterChangeCommit?: ChangeCommitCallback;
397
+ /**
398
+ * Is called once per db before migrating (up) a set of migrations.
399
+ *
400
+ * @param arg.db - query builder
401
+ * @param arg.migrations - applied migrations
402
+ */
403
+ beforeMigrate?: MigrationCallback;
404
+ /**
405
+ * Is called once per db after migrating (up) a set of migrations.
406
+ *
407
+ * @param arg.db - query builder
408
+ * @param arg.migrations - applied migrations
409
+ */
410
+ afterMigrate?: MigrationCallback;
411
+ /**
412
+ * Is called once per db before rolling back a set of migrations.
413
+ *
414
+ * @param arg.db - query builder
415
+ * @param arg.migrations - rolled back migrations
416
+ */
417
+ beforeRollback?: MigrationCallback;
418
+ /**
419
+ * Is called once per db before rolling back a set of migrations.
420
+ *
421
+ * @param arg.db - query builder
422
+ * @param arg.migrations - rolled back migrations
423
+ */
424
+ afterRollback?: MigrationCallback;
425
+ }
426
+ interface InputRakeDbConfigFileBased<SchemaConfig extends ColumnSchemaConfig, CT> extends InputRakeDbConfigBase<SchemaConfig, CT> {
427
+ /**
428
+ * It may look odd, but it's required for `tsx` and other bundlers to have such `import` config specified explicitly.
429
+ */
430
+ import(path: string): Promise<unknown>;
431
+ }
432
+ interface InputRakeDbConfigCodeBased<SchemaConfig extends ColumnSchemaConfig, CT> extends InputRakeDbConfigBase<SchemaConfig, CT> {
433
+ /**
434
+ * To specify array of migrations explicitly, without loading them from files.
435
+ */
436
+ migrations: ModuleExportsRecord;
437
+ renameMigrations?: RakeDbRenameMigrationsInput;
438
+ /**
439
+ * It may look odd, but it's required for `tsx` and other bundlers to have such `import` config specified explicitly.
440
+ */
441
+ import?(path: string): Promise<unknown>;
442
+ }
443
+ type InputRakeDbConfig<SchemaConfig extends ColumnSchemaConfig, CT> = InputRakeDbConfigFileBased<SchemaConfig, CT> | InputRakeDbConfigCodeBased<SchemaConfig, CT>;
444
+ interface ChangeCallback$1 {
445
+ (arg: {
446
+ db: DbResult<unknown>;
447
+ up: boolean;
448
+ redo: boolean;
449
+ migrations: MigrationItem[];
450
+ }): void | Promise<void>;
451
+ }
452
+ interface ChangeCommitCallback {
453
+ (arg: {
454
+ adapter: AdapterBase;
455
+ up: boolean;
456
+ migrations: MigrationItem[];
457
+ }): void | Promise<void>;
458
+ }
459
+ interface MigrationCallback {
460
+ (arg: {
461
+ db: DbResult<unknown>;
462
+ migrations: MigrationItem[];
463
+ }): void | Promise<void>;
464
+ }
465
+ type AnyRakeDbConfig = RakeDbConfig<any, any>;
466
+ interface RakeDbBaseTable<CT> {
467
+ exportAs: string;
468
+ getFilePath(): string;
469
+ nowSQL?: string;
470
+ new (): {
471
+ types: CT;
472
+ snakeCase?: boolean;
473
+ language?: string;
474
+ };
475
+ }
476
+ interface ModuleExportsRecord {
477
+ [K: string]: () => Promise<unknown>;
478
+ }
479
+ type RakeDbMigrationId = 'timestamp' | {
480
+ serial: number;
481
+ };
482
+ interface RakeDbRenameMigrationsMap {
483
+ [K: string]: number;
484
+ }
485
+ interface RakeDbRenameMigrations {
486
+ to: RakeDbMigrationId;
487
+ map(): MaybePromise<RakeDbRenameMigrationsMap>;
488
+ }
489
+ interface RakeDbRenameMigrationsInput {
490
+ to: RakeDbMigrationId;
491
+ map: RakeDbRenameMigrationsMap;
492
+ }
493
+ declare const migrationConfigDefaults: RakeDbBaseConfig<ColumnSchemaConfig>;
494
+
269
495
  type DropMode = 'CASCADE' | 'RESTRICT';
270
496
  type TableOptions = {
271
497
  createIfNotExists?: boolean;
@@ -288,17 +514,16 @@ type ChangeTableOptions = {
288
514
  comment?: string | [string, string] | null;
289
515
  };
290
516
  type ChangeTableCallback<CT> = (t: TableChanger<CT>) => TableChangeData;
291
- type ColumnComment = {
292
- column: string;
293
- comment: string | null;
294
- };
295
517
  type SilentQueries = {
296
- silentQuery: Adapter['query'];
297
- silentArrays: Adapter['arrays'];
518
+ silentQuery: AdapterBase['query'];
519
+ silentArrays: AdapterBase['arrays'];
298
520
  };
299
521
  type DbMigration<CT> = DbResult<CT> & Migration<CT> & {
300
522
  adapter: SilentQueries;
301
523
  };
524
+ interface CreateMigrationInterfaceConfig<CT> extends QueryLogOptions {
525
+ columnTypes: CT;
526
+ }
302
527
  /**
303
528
  * Creates a new `db` instance that is an instance of `pqb` with mixed in migration methods from the `Migration` class.
304
529
  * It overrides `query` and `array` db adapter methods to intercept SQL for the logging.
@@ -307,8 +532,8 @@ type DbMigration<CT> = DbResult<CT> & Migration<CT> & {
307
532
  * @param up - migrate or rollback
308
533
  * @param config - config of `rakeDb`
309
534
  */
310
- declare const createMigrationInterface: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(tx: TransactionAdapter, up: boolean, config: RakeDbConfig<SchemaConfig, CT>) => DbMigration<CT>;
311
- interface MigrationAdapter extends TransactionAdapter {
535
+ declare const createMigrationInterface: <CT>(tx: AdapterBase, up: boolean, config: CreateMigrationInterfaceConfig<CT>) => DbMigration<CT>;
536
+ interface MigrationAdapter extends AdapterBase {
312
537
  schema: string;
313
538
  }
314
539
  declare class Migration<CT> {
@@ -1214,281 +1439,107 @@ declare class Migration<CT> {
1214
1439
  */
1215
1440
  constraintExists(constraintName: string): Promise<boolean>;
1216
1441
  }
1217
- declare const renameType: (migration: Migration<unknown>, from: string, to: string, kind: RakeDbAst.RenameType['kind']) => Promise<void>;
1218
1442
  interface AddEnumValueOptions {
1219
1443
  ifNotExists?: boolean;
1220
1444
  before?: string;
1221
1445
  after?: string;
1222
1446
  }
1223
- declare const addOrDropEnumValues: (migration: Migration<unknown>, up: boolean, enumName: string, values: string[], options?: AddEnumValueOptions) => Promise<void>;
1224
- declare const changeEnumValues: (migration: Migration<unknown>, enumName: string, fromValues: string[], toValues: string[]) => Promise<void>;
1225
1447
 
1226
- interface TableQuery {
1227
- text: string;
1228
- values?: unknown[];
1229
- then?(result: QueryArraysResult): void;
1230
- }
1231
- interface CreateTableResult<Table extends string, Shape extends ColumnsShape> {
1232
- table: Db<Table, Shape>;
1448
+ interface MigrationChange {
1449
+ fn: ChangeCallback<unknown>;
1450
+ config: RakeDbConfig<ColumnSchemaConfig, unknown>;
1233
1451
  }
1452
+ type ChangeCallback<CT> = (db: DbMigration<CT>, up: boolean) => Promise<void>;
1234
1453
 
1235
- interface RakeDbCtx {
1236
- migrationsPromise?: Promise<MigrationsSet>;
1237
- }
1238
- declare const getFirstWordAndRest: (input: string) => [
1239
- string
1240
- ] | [
1241
- string,
1242
- string
1243
- ];
1244
- declare const getTextAfterTo: (input: string) => string | undefined;
1245
- declare const getTextAfterFrom: (input: string) => string | undefined;
1246
- declare const joinWords: (...words: string[]) => string;
1247
- declare const joinColumns: (columns: string[]) => string;
1248
- declare const quoteWithSchema: ({ schema, name, }: {
1249
- schema?: string;
1250
- name: string;
1251
- }) => string;
1252
- declare const quoteTable: (schema: string | undefined, table: string) => string;
1253
- declare const getSchemaAndTableFromName: (name: string) => [string | undefined, string];
1254
- declare const quoteNameFromString: (string: string) => string;
1255
1454
  /**
1256
- * Do not quote the type itself because it can be an expression like `geography(point)` for postgis.
1455
+ * Type of {@link rakeDbWithAdapters} function
1257
1456
  */
1258
- declare const quoteCustomType: (s: string) => string;
1259
- declare const quoteSchemaTable: (arg: {
1260
- schema?: string;
1261
- name: string;
1262
- }) => string;
1263
- declare const concatSchemaAndName: ({ schema, name, }: {
1264
- schema?: string;
1265
- name: string;
1266
- }) => string;
1267
- declare const makePopulateEnumQuery: (item: EnumColumn<ColumnSchemaConfig, unknown, readonly string[]>) => TableQuery;
1268
- declare const transaction: <T>(adapter: Adapter, fn: (trx: TransactionAdapter) => Promise<T>) => Promise<T>;
1269
- declare const queryLock: (trx: TransactionAdapter) => Promise<pqb.QueryResult<any>>;
1270
- declare const exhaustive: (_: never) => never;
1271
- declare const pluralize: (w: string, count: number, append?: string) => string;
1272
-
1273
- interface MigrationItem {
1274
- path: string;
1275
- version: string;
1457
+ interface RakeDbFn<Options> {
1458
+ <SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>>(options: Options, partialConfig: InputRakeDbConfig<SchemaConfig, CT>, args?: string[]): RakeDbChangeFnWithPromise<CT>;
1276
1459
  /**
1277
- * Function that loads the migration content,
1278
- * can store lazy import of a migration file.
1279
- * Promise can return `{ default: x }` where `x` is a return of `change` or an array of such returns.
1460
+ * Unlike the original `rakeDb` that executes immediately,
1461
+ * `rakeDb.lazy` returns the `run` function to be later called programmatically.
1462
+ *
1463
+ * @param options - array of connection adapters for migrating multiple dbs
1464
+ * @param config - {@link RakeDbConfig}
1465
+ * @returns `change` is to be used in migrations, `run` takes an array cli args to execute a command
1280
1466
  */
1281
- load(): Promise<unknown>;
1467
+ lazy<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>>(options: Options, config: InputRakeDbConfig<SchemaConfig, CT>): {
1468
+ change: RakeDbChangeFn<CT>;
1469
+ run(args: string[], config?: Partial<RakeDbConfig<SchemaConfig, CT>>): Promise<RakeDbResult>;
1470
+ };
1282
1471
  }
1283
- interface MigrationsSet {
1284
- renameTo?: RakeDbRenameMigrations;
1285
- migrations: MigrationItem[];
1472
+ interface RakeDbResult {
1473
+ adapters: AdapterBase[];
1474
+ config: AnyRakeDbConfig;
1475
+ args: string[];
1286
1476
  }
1287
-
1288
- interface CommandFn<SchemaConfig extends ColumnSchemaConfig, CT> {
1289
- (options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>, args: string[]): void | Promise<void>;
1477
+ /**
1478
+ * Function to use in migrations to wrap database changes
1479
+ * Saves the given callback to an internal queue,
1480
+ * and also returns the callback in case you want to export it from migration.
1481
+ */
1482
+ interface RakeDbChangeFn<CT> {
1483
+ (fn: ChangeCallback<CT>): MigrationChange;
1290
1484
  }
1291
- interface RakeDbBaseConfig<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>> extends QueryLogOptions {
1292
- schemaConfig: SchemaConfig;
1293
- migrationsPath: string;
1294
- migrationId: RakeDbMigrationId;
1295
- migrations?: ModuleExportsRecord;
1296
- renameMigrations?: RakeDbRenameMigrationsInput;
1297
- migrationsTable: string;
1298
- snakeCase: boolean;
1299
- language?: string;
1300
- commands: Record<string, CommandFn<SchemaConfig, CT>>;
1301
- noPrimaryKey?: NoPrimaryKeyOption;
1302
- baseTable?: RakeDbBaseTable<CT>;
1303
- forceDefaultExports?: boolean;
1304
- import(path: string): Promise<unknown>;
1305
- beforeChange?: ChangeCallback$1;
1306
- afterChange?: ChangeCallback$1;
1307
- afterChangeCommit?: ChangeCommitCallback;
1308
- beforeMigrate?: MigrationCallback;
1309
- afterMigrate?: MigrationCallback;
1310
- beforeRollback?: MigrationCallback;
1311
- afterRollback?: MigrationCallback;
1312
- }
1313
- interface RakeDbConfig<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>> extends RakeDbBaseConfig<SchemaConfig, CT> {
1314
- columnTypes: CT;
1315
- basePath: string;
1316
- dbScript: string;
1317
- recurrentPath: string;
1318
- }
1319
- interface InputRakeDbConfigBase<SchemaConfig extends ColumnSchemaConfig, CT> extends QueryLogOptions {
1320
- columnTypes?: CT | ((t: DefaultColumnTypes<DefaultSchemaConfig>) => CT);
1321
- baseTable?: RakeDbBaseTable<CT>;
1322
- schemaConfig?: SchemaConfig;
1323
- basePath?: string;
1324
- dbScript?: string;
1325
- migrationsPath?: string;
1326
- migrationId?: 'serial' | RakeDbMigrationId;
1327
- recurrentPath?: string;
1328
- migrationsTable?: string;
1329
- snakeCase?: boolean;
1330
- language?: string;
1331
- commands?: Record<string, (options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>, args: string[]) => void | Promise<void>>;
1332
- noPrimaryKey?: NoPrimaryKeyOption;
1333
- forceDefaultExports?: boolean;
1334
- /**
1335
- * Is called once per db before migrating or rolling back a set of migrations.
1336
- *
1337
- * @param arg.db - query builder
1338
- * @param arg.up - whether it's migrating up or down
1339
- * @param arg.redo - whether it's migrating down and then up for `redo` command
1340
- * @param arg.migrations - array of executed (up or down) migrations
1341
- */
1342
- beforeChange?: ChangeCallback$1;
1343
- /**
1344
- * Is called once per db after migrating or rolling back a set of migrations.
1345
- * Runs inside the same transaction as migrations,
1346
- * for running after commit use {@link afterChangeCommit}.
1347
- *
1348
- * @param arg.db - query builder
1349
- * @param arg.up - whether it's migrating up or down
1350
- * @param arg.redo - whether it's migrating down and then up for `redo` command
1351
- * @param arg.migrations - array of executed (up or down) migrations
1352
- */
1353
- afterChange?: ChangeCallback$1;
1354
- /**
1355
- * Is called once per db after migrating or rolling back a set of migrations.
1356
- * Runs **after** committing migrations transaction.
1357
- *
1358
- * @param arg.options - database connection options
1359
- * @param arg.up - whether it's migrating up or down
1360
- * @param arg.migrations - array of executed (up or down) migrations
1361
- */
1362
- afterChangeCommit?: ChangeCommitCallback;
1363
- /**
1364
- * Is called once per db before migrating (up) a set of migrations.
1365
- *
1366
- * @param arg.db - query builder
1367
- * @param arg.migrations - applied migrations
1368
- */
1369
- beforeMigrate?: MigrationCallback;
1370
- /**
1371
- * Is called once per db after migrating (up) a set of migrations.
1372
- *
1373
- * @param arg.db - query builder
1374
- * @param arg.migrations - applied migrations
1375
- */
1376
- afterMigrate?: MigrationCallback;
1377
- /**
1378
- * Is called once per db before rolling back a set of migrations.
1379
- *
1380
- * @param arg.db - query builder
1381
- * @param arg.migrations - rolled back migrations
1382
- */
1383
- beforeRollback?: MigrationCallback;
1384
- /**
1385
- * Is called once per db before rolling back a set of migrations.
1386
- *
1387
- * @param arg.db - query builder
1388
- * @param arg.migrations - rolled back migrations
1389
- */
1390
- afterRollback?: MigrationCallback;
1391
- }
1392
- interface InputRakeDbConfigFileBased<SchemaConfig extends ColumnSchemaConfig, CT> extends InputRakeDbConfigBase<SchemaConfig, CT> {
1393
- /**
1394
- * It may look odd, but it's required for `tsx` and other bundlers to have such `import` config specified explicitly.
1395
- */
1396
- import(path: string): Promise<unknown>;
1397
- }
1398
- interface InputRakeDbConfigCodeBased<SchemaConfig extends ColumnSchemaConfig, CT> extends InputRakeDbConfigBase<SchemaConfig, CT> {
1399
- /**
1400
- * To specify array of migrations explicitly, without loading them from files.
1401
- */
1402
- migrations: ModuleExportsRecord;
1403
- renameMigrations?: RakeDbRenameMigrationsInput;
1404
- /**
1405
- * It may look odd, but it's required for `tsx` and other bundlers to have such `import` config specified explicitly.
1406
- */
1407
- import?(path: string): Promise<unknown>;
1408
- }
1409
- type InputRakeDbConfig<SchemaConfig extends ColumnSchemaConfig, CT> = InputRakeDbConfigFileBased<SchemaConfig, CT> | InputRakeDbConfigCodeBased<SchemaConfig, CT>;
1410
- interface ChangeCallback$1 {
1411
- (arg: {
1412
- db: DbResult<unknown>;
1413
- up: boolean;
1414
- redo: boolean;
1415
- migrations: MigrationItem[];
1416
- }): void | Promise<void>;
1485
+ interface RakeDbChangeFnWithPromise<CT> extends RakeDbChangeFn<CT> {
1486
+ promise: Promise<RakeDbResult>;
1417
1487
  }
1418
- interface ChangeCommitCallback {
1419
- (arg: {
1420
- options: AdapterOptions;
1421
- up: boolean;
1422
- migrations: MigrationItem[];
1423
- }): void | Promise<void>;
1488
+ /**
1489
+ * Function to configure and run `rakeDb`.
1490
+ *
1491
+ * @param options - {@link NodePostgresAdapterOptions} or an array of such options to migrate multiple dbs
1492
+ * @param config - {@link RakeDbConfig}
1493
+ * @param args - optionally provide an array of cli args. Default is `process.argv.slice(2)`.
1494
+ */
1495
+ declare const rakeDbWithAdapters: RakeDbFn<AdapterBase[]>;
1496
+ interface RakeDbCommand {
1497
+ run(adapters: AdapterBase[], config: AnyRakeDbConfig, args: string[]): MaybePromise<unknown>;
1498
+ help: string;
1499
+ helpArguments?: RecordString;
1500
+ helpAfter?: string;
1424
1501
  }
1425
- interface MigrationCallback {
1426
- (arg: {
1427
- db: DbResult<unknown>;
1428
- migrations: MigrationItem[];
1429
- }): void | Promise<void>;
1502
+ interface RakeDbCommands {
1503
+ [K: string]: RakeDbCommand;
1430
1504
  }
1431
- type AnyRakeDbConfig = RakeDbConfig<any, any>;
1432
- interface RakeDbBaseTable<CT> {
1433
- exportAs: string;
1434
- getFilePath(): string;
1435
- nowSQL?: string;
1436
- new (): {
1437
- types: CT;
1438
- snakeCase?: boolean;
1439
- language?: string;
1505
+ declare const rakeDbCommands: RakeDbCommands;
1506
+
1507
+ declare const encodeColumnDefault: (def: unknown, values: unknown[], column?: ColumnTypeBase) => string | null;
1508
+ declare const getConstraintName: (table: string, constraint: {
1509
+ references?: {
1510
+ columns: string[];
1440
1511
  };
1512
+ check?: unknown;
1513
+ identity?: unknown;
1514
+ }, snakeCase: boolean | undefined) => string;
1515
+ interface GetIndexOrExcludeName {
1516
+ (table: string, columns: ({
1517
+ column?: string;
1518
+ } | {
1519
+ expression: string;
1520
+ })[]): string;
1441
1521
  }
1442
- interface ModuleExportsRecord {
1443
- [K: string]: () => Promise<unknown>;
1444
- }
1445
- type RakeDbMigrationId = 'timestamp' | {
1446
- serial: number;
1447
- };
1448
- interface RakeDbRenameMigrationsMap {
1449
- [K: string]: number;
1450
- }
1451
- interface RakeDbRenameMigrations {
1452
- to: RakeDbMigrationId;
1453
- map(): MaybePromise<RakeDbRenameMigrationsMap>;
1454
- }
1455
- interface RakeDbRenameMigrationsInput {
1456
- to: RakeDbMigrationId;
1457
- map: RakeDbRenameMigrationsMap;
1458
- }
1459
- declare const migrationConfigDefaults: RakeDbBaseConfig<ColumnSchemaConfig>;
1460
- declare const processRakeDbConfig: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(config: InputRakeDbConfig<SchemaConfig, CT>) => RakeDbConfig<SchemaConfig, CT>;
1461
- declare const getDatabaseAndUserFromOptions: (options: AdapterOptions) => {
1462
- database: string;
1463
- user: string;
1464
- };
1465
-
1466
- declare const createDb: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>) => Promise<void>;
1467
- declare const dropDb: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>) => Promise<void>;
1468
- declare const resetDb: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>) => Promise<void>;
1522
+ declare const getIndexName: GetIndexOrExcludeName;
1523
+ declare const getExcludeName: GetIndexOrExcludeName;
1469
1524
 
1470
- declare const writeMigrationFile: (config: AnyRakeDbConfig, version: string, name: string, migrationCode: string) => Promise<void>;
1471
- declare const newMigration: (config: AnyRakeDbConfig, [name]: string[]) => Promise<void>;
1472
- declare const makeFileVersion: (ctx: RakeDbCtx, config: AnyRakeDbConfig) => Promise<string>;
1473
- declare const generateTimeStamp: () => string;
1525
+ declare const promptSelect: ({ message, options, active, inactive, }: {
1526
+ message: string;
1527
+ options: string[];
1528
+ active?: (s: string) => string;
1529
+ inactive?: (s: string) => string;
1530
+ }) => Promise<number>;
1474
1531
 
1475
- type ChangeCallback<CT> = (db: DbMigration<CT>, up: boolean) => Promise<void>;
1476
- declare const clearChanges: () => void;
1477
- declare const getCurrentChanges: () => ChangeCallback<unknown>[];
1478
- declare const pushChange: (fn: ChangeCallback<unknown>) => number;
1532
+ declare const saveMigratedVersion: (db: SilentQueries, version: string, name: string, config: PickMigrationsTable) => Promise<void>;
1479
1533
 
1480
- declare const saveMigratedVersion: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(db: SilentQueries, version: string, name: string, config: RakeDbConfig<SchemaConfig, CT>) => Promise<void>;
1481
- declare const deleteMigratedVersion: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(db: SilentQueries, version: string, name: string, config: RakeDbConfig<SchemaConfig, CT>) => Promise<void>;
1482
- declare class NoMigrationsTableError extends Error {
1534
+ interface MigrateFnConfig extends MigrateOrRollbackConfig, PickAfterChangeCommit, PickBasePath, PickImport, PickMigrationsPath {
1483
1535
  }
1484
- type RakeDbAppliedVersions = {
1485
- map: RecordOptionalString;
1486
- sequence: number[];
1487
- };
1488
- declare const getMigratedVersionsMap: <SchemaConfig extends ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>, CT>(ctx: RakeDbCtx, adapter: Adapter | TransactionAdapter, config: RakeDbConfig<SchemaConfig, CT>, renameTo?: RakeDbRenameMigrations) => Promise<RakeDbAppliedVersions>;
1489
-
1490
- declare const RAKE_DB_LOCK_KEY = "8582141715823621641";
1491
- type MigrateFn = <SchemaConfig extends ColumnSchemaConfig, CT>(ctx: RakeDbCtx, options: AdapterOptions[], config: RakeDbConfig<SchemaConfig, CT>, args?: string[], adapters?: Adapter[], dontClose?: boolean) => Promise<Adapter[]>;
1536
+ type MigrateFn = (params: {
1537
+ ctx?: RakeDbCtx;
1538
+ adapter: AdapterBase;
1539
+ config: MigrateFnConfig;
1540
+ count?: number;
1541
+ force?: boolean;
1542
+ }) => Promise<void>;
1492
1543
  /**
1493
1544
  * Will run all pending yet migrations, sequentially in order,
1494
1545
  * will apply `change` functions top-to-bottom.
@@ -1498,21 +1549,10 @@ type MigrateFn = <SchemaConfig extends ColumnSchemaConfig, CT>(ctx: RakeDbCtx, o
1498
1549
  * @param args - pass none or `all` to run all migrations, pass int for how many to migrate
1499
1550
  */
1500
1551
  declare const migrate: MigrateFn;
1501
- /**
1502
- * Will roll back one latest applied migration,
1503
- * will apply `change` functions bottom-to-top.
1504
- *
1505
- * Takes the same options as {@link migrate}.
1506
- */
1507
- declare const rollback: MigrateFn;
1508
- /**
1509
- * Calls {@link rollback} and then {@link migrate}.
1510
- *
1511
- * Takes the same options as {@link migrate}.
1512
- */
1513
- declare const redo: MigrateFn;
1514
- declare const migrateOrRollback: (trx: TransactionAdapter, config: RakeDbConfig<ColumnSchemaConfig, unknown>, set: MigrationsSet, versions: RakeDbAppliedVersions, count: number, up: boolean, redo: boolean, force?: boolean, skipLock?: boolean) => Promise<MigrationItem[]>;
1515
- declare const changeCache: Record<string, ChangeCallback<unknown>[] | undefined>;
1552
+ declare const migrateAndClose: MigrateFn;
1553
+ interface MigrateOrRollbackConfig extends PickMigrationCallbacks, PickMigrationId, QueryLogOptions, PickForceDefaultExports, PickMigrationsTable {
1554
+ columnTypes: unknown;
1555
+ }
1516
1556
 
1517
1557
  declare namespace DbStructure {
1518
1558
  interface TableNameAndSchemaName {
@@ -1676,7 +1716,9 @@ interface IntrospectedStructure {
1676
1716
  domains: DbStructure.Domain[];
1677
1717
  collations: DbStructure.Collation[];
1678
1718
  }
1679
- declare function introspectDbSchema(db: Adapter): Promise<IntrospectedStructure>;
1719
+ declare function introspectDbSchema(db: AdapterBase): Promise<IntrospectedStructure>;
1720
+
1721
+ declare const astToMigration: (currentSchema: string, config: AnyRakeDbConfig, asts: RakeDbAst[]) => string | undefined;
1680
1722
 
1681
1723
  interface StructureToAstCtx {
1682
1724
  snakeCase?: boolean;
@@ -1692,156 +1734,24 @@ interface StructureToAstTableData {
1692
1734
  constraints: DbStructure.Constraint[];
1693
1735
  }
1694
1736
  declare const makeStructureToAstCtx: (config: AnyRakeDbConfig, currentSchema: string) => StructureToAstCtx;
1695
- declare const structureToAst: (ctx: StructureToAstCtx, adapter: Adapter, config: AnyRakeDbConfig) => Promise<RakeDbAst[]>;
1737
+ declare const structureToAst: (ctx: StructureToAstCtx, adapter: AdapterBase, config: AnyRakeDbConfig) => Promise<RakeDbAst[]>;
1696
1738
  declare const makeDomainsMap: (ctx: StructureToAstCtx, data: IntrospectedStructure) => DbStructureDomainsMap;
1697
1739
  declare const instantiateDbColumn: (ctx: StructureToAstCtx, data: IntrospectedStructure, domains: DbStructureDomainsMap, dbColumn: DbStructure.Column) => ColumnType<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any>;
1698
1740
  declare const tableToAst: (ctx: StructureToAstCtx, data: IntrospectedStructure, table: DbStructure.Table, action: 'create' | 'drop', domains: DbStructureDomainsMap) => RakeDbAst.Table;
1699
1741
  declare const getDbStructureTableData: (data: IntrospectedStructure, { name, schemaName }: DbStructure.Table) => StructureToAstTableData;
1700
- declare const makeDbStructureColumnsShape: (ctx: StructureToAstCtx, data: IntrospectedStructure, domains: DbStructureDomainsMap, table: DbStructure.Table | DbStructure.View, tableData?: StructureToAstTableData) => ColumnsShape;
1701
1742
  interface ColumnChecks {
1702
1743
  [K: string]: string[];
1703
1744
  }
1704
1745
  declare const getDbTableColumnsChecks: (tableData: StructureToAstTableData) => ColumnChecks;
1705
1746
  declare const dbColumnToAst: (ctx: StructureToAstCtx, data: IntrospectedStructure, domains: DbStructureDomainsMap, tableName: string, item: DbStructure.Column, table?: DbStructure.Table, tableData?: StructureToAstTableData, checks?: ColumnChecks) => [key: string, column: ColumnType];
1706
1747
 
1707
- declare const astToMigration: (currentSchema: string, config: AnyRakeDbConfig, asts: RakeDbAst[]) => string | undefined;
1708
-
1709
- declare const versionToString: (config: AnyRakeDbConfig, version: number) => string;
1710
- declare const columnTypeToSql: (item: ColumnTypeBase) => string;
1711
- declare const getColumnName: (item: {
1712
- data: {
1713
- name?: string;
1714
- };
1715
- }, key: string, snakeCase: boolean | undefined) => string;
1716
- declare const columnToSql: (name: string, item: ColumnType, values: unknown[], hasMultiplePrimaryKeys: boolean, snakeCase: boolean | undefined) => string;
1717
- declare const encodeColumnDefault: (def: unknown, values: unknown[], column?: ColumnTypeBase) => string | null;
1718
- declare const identityToSql: (identity: TableData.Identity) => string;
1719
- declare const addColumnIndex: (indexes: TableData.Index[], name: string, item: ColumnType) => void;
1720
- declare const addColumnExclude: (excludes: TableData.Exclude[], name: string, item: ColumnType) => void;
1721
- declare const addColumnComment: (comments: ColumnComment[], name: string, item: ColumnType) => void;
1722
- declare const getForeignKeyTable: (fnOrTable: (() => ForeignKeyTable) | string) => [string | undefined, string];
1723
- declare const getConstraintName: (table: string, constraint: {
1724
- references?: {
1725
- columns: string[];
1726
- };
1727
- check?: unknown;
1728
- identity?: unknown;
1729
- }, snakeCase: boolean | undefined) => string;
1730
- declare const constraintToSql: ({ name }: {
1731
- schema?: string;
1732
- name: string;
1733
- }, up: boolean, constraint: TableData.Constraint, values: unknown[], snakeCase: boolean | undefined) => string;
1734
- declare const referencesToSql: (references: TableData.References, snakeCase: boolean | undefined) => string;
1735
- interface GetIndexOrExcludeName {
1736
- (table: string, columns: ({
1737
- column?: string;
1738
- } | {
1739
- expression: string;
1740
- })[]): string;
1741
- }
1742
- declare const getIndexName: GetIndexOrExcludeName;
1743
- declare const getExcludeName: GetIndexOrExcludeName;
1744
- declare const indexesToQuery: (up: boolean, { schema, name: tableName }: {
1745
- schema?: string;
1746
- name: string;
1747
- }, indexes: TableData.Index[], snakeCase: boolean | undefined, language?: string) => SingleSql[];
1748
- declare const excludesToQuery: (up: boolean, { schema, name: tableName }: {
1749
- schema?: string;
1750
- name: string;
1751
- }, excludes: TableData.Exclude[], snakeCase: boolean | undefined) => SingleSql[];
1752
- declare const commentsToQuery: (schemaTable: {
1753
- schema?: string;
1754
- name: string;
1755
- }, comments: ColumnComment[]) => SingleSql[];
1756
- declare const primaryKeyToSql: (primaryKey: Exclude<TableData['primaryKey'], undefined>) => string;
1757
- declare const interpolateSqlValues: ({ text, values }: TableQuery) => string;
1758
- interface ColumnNamedCheck extends ColumnDataCheckBase {
1759
- name: string;
1760
- }
1761
- declare const nameColumnChecks: (table: string, column: string, checks: ColumnDataCheckBase[]) => ColumnNamedCheck[];
1762
- declare const cmpRawSql: (a: RawSQLBase, b: RawSQLBase) => boolean;
1748
+ declare const writeMigrationFile: (config: AnyRakeDbConfig, version: string, name: string, migrationCode: string) => Promise<void>;
1749
+ declare const makeFileVersion: (ctx: RakeDbCtx, config: AnyRakeDbConfig) => Promise<string>;
1763
1750
 
1764
- /**
1765
- * Type of {@link rakeDb} function
1766
- */
1767
- interface RakeDbFn {
1768
- <SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>>(options: MaybeArray<AdapterOptions>, partialConfig: InputRakeDbConfig<SchemaConfig, CT>, args?: string[]): RakeDbChangeFnWithPromise<CT>;
1769
- /**
1770
- * Unlike the original `rakeDb` that executes immediately,
1771
- * `rakeDb.lazy` returns the `run` function to be later called programmatically.
1772
- *
1773
- * @param options - {@link AdapterOptions} or an array of such options to migrate multiple dbs
1774
- * @param config - {@link RakeDbConfig}
1775
- * @returns `change` is to be used in migrations, `run` takes an array cli args to execute a command
1776
- */
1777
- lazy<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>>(options: MaybeArray<AdapterOptions>, config: InputRakeDbConfig<SchemaConfig, CT>): {
1778
- change: RakeDbChangeFn<CT>;
1779
- run(args: string[], config?: Partial<RakeDbConfig<SchemaConfig, CT>>): Promise<RakeDbResult>;
1780
- };
1781
- }
1782
- interface RakeDbResult {
1783
- options: AdapterOptions[];
1784
- config: AnyRakeDbConfig;
1785
- args: string[];
1786
- }
1787
- /**
1788
- * Function to use in migrations to wrap database changes
1789
- * Saves the given callback to an internal queue,
1790
- * and also returns the callback in case you want to export it from migration.
1791
- */
1792
- interface RakeDbChangeFn<CT> {
1793
- (fn: ChangeCallback<CT>): ChangeCallback<CT>;
1751
+ interface OrmParam {
1752
+ $qb: QueryBase;
1794
1753
  }
1795
- interface RakeDbChangeFnWithPromise<CT> extends RakeDbChangeFn<CT> {
1796
- promise: Promise<RakeDbResult>;
1797
- }
1798
- /**
1799
- * Function to configure and run `rakeDb`.
1800
- *
1801
- * @param options - {@link AdapterOptions} or an array of such options to migrate multiple dbs
1802
- * @param config - {@link RakeDbConfig}
1803
- * @param args - optionally provide an array of cli args. Default is `process.argv.slice(2)`.
1804
- */
1805
- declare const rakeDb: RakeDbFn;
1806
- declare const rakeDbAliases: RecordOptionalString;
1807
- interface RakeDbCommand {
1808
- run(options: AdapterOptions[], config: AnyRakeDbConfig, args: string[]): MaybePromise<unknown>;
1809
- help: string;
1810
- helpArguments?: RecordString;
1811
- helpAfter?: string;
1812
- }
1813
- interface RakeDbCommands {
1814
- [K: string]: RakeDbCommand;
1815
- }
1816
- declare const rakeDbCommands: RakeDbCommands;
1817
-
1818
- declare const colors: {
1819
- yellow: (s: string) => string;
1820
- green: (s: string) => string;
1821
- red: (s: string) => string;
1822
- blue: (s: string) => string;
1823
- bright: (s: string) => string;
1824
- blueBold: (s: string) => string;
1825
- yellowBold: (s: string) => string;
1826
- greenBold: (s: string) => string;
1827
- pale: (s: string) => string;
1828
- };
1829
-
1830
- declare const promptSelect: ({ message, options, active, inactive, }: {
1831
- message: string;
1832
- options: string[];
1833
- active?: (s: string) => string;
1834
- inactive?: (s: string) => string;
1835
- }) => Promise<number>;
1836
- declare const promptConfirm: ({ message, }: {
1837
- message: string;
1838
- password?: boolean;
1839
- }) => Promise<boolean>;
1840
- declare const promptText: ({ message, default: def, password, min, }: {
1841
- message: string;
1842
- default?: string;
1843
- password?: boolean;
1844
- min?: number;
1845
- }) => Promise<string>;
1754
+ type UnknownPromiseFns = (() => Promise<unknown>)[];
1755
+ declare const migrateFiles: (db: OrmParam, files: UnknownPromiseFns) => Promise<void>;
1846
1756
 
1847
- export { type AnyRakeDbConfig, type ChangeCallback, type ChangeTableCallback, type ChangeTableOptions, type ColumnChecks, type ColumnComment, type ColumnNamedCheck, type ColumnsShapeCallback, type CommandFn, type DbMigration, DbStructure, type DropMode, type GetIndexOrExcludeName, type InputRakeDbConfig, type InputRakeDbConfigBase, type IntrospectedStructure, Migration, type MigrationAdapter, type MigrationColumnTypes, type ModuleExportsRecord, NoMigrationsTableError, RAKE_DB_LOCK_KEY, type RakeDbAppliedVersions, RakeDbAst, type RakeDbBaseTable, type RakeDbConfig, type RakeDbCtx, type RakeDbFn, type RakeDbMigrationId, type RakeDbRenameMigrations, type RakeDbRenameMigrationsInput, type RakeDbRenameMigrationsMap, type RakeDbResult, type SilentQueries, type StructureToAstCtx, type StructureToAstTableData, type TableOptions, addColumnComment, addColumnExclude, addColumnIndex, addOrDropEnumValues, astToMigration, changeCache, changeEnumValues, clearChanges, cmpRawSql, colors, columnToSql, columnTypeToSql, commentsToQuery, concatSchemaAndName, constraintToSql, createDb, createMigrationInterface, dbColumnToAst, deleteMigratedVersion, dropDb, encodeColumnDefault, excludesToQuery, exhaustive, generateTimeStamp, getColumnName, getConstraintName, getCurrentChanges, getDatabaseAndUserFromOptions, getDbStructureTableData, getDbTableColumnsChecks, getExcludeName, getFirstWordAndRest, getForeignKeyTable, getIndexName, getMigratedVersionsMap, getSchemaAndTableFromName, getTextAfterFrom, getTextAfterTo, identityToSql, indexesToQuery, instantiateDbColumn, interpolateSqlValues, introspectDbSchema, joinColumns, joinWords, makeDbStructureColumnsShape, makeDomainsMap, makeFileVersion, makePopulateEnumQuery, makeStructureToAstCtx, migrate, migrateOrRollback, migrationConfigDefaults, nameColumnChecks, newMigration, pluralize, primaryKeyToSql, processRakeDbConfig, promptConfirm, promptSelect, promptText, pushChange, queryLock, quoteCustomType, quoteNameFromString, quoteSchemaTable, quoteTable, quoteWithSchema, rakeDb, rakeDbAliases, rakeDbCommands, redo, referencesToSql, renameType, resetDb, rollback, saveMigratedVersion, structureToAst, tableToAst, transaction, versionToString, writeMigrationFile };
1757
+ export { type AnyRakeDbConfig, type ChangeCallback, type DbMigration, DbStructure, type InputRakeDbConfigBase, type IntrospectedStructure, RakeDbAst, type RakeDbChangeFn, type RakeDbChangeFnWithPromise, type RakeDbConfig, type SilentQueries, type StructureToAstCtx, type StructureToAstTableData, astToMigration, concatSchemaAndName, createMigrationInterface, dbColumnToAst, encodeColumnDefault, getConstraintName, getDbStructureTableData, getDbTableColumnsChecks, getExcludeName, getIndexName, getSchemaAndTableFromName, instantiateDbColumn, introspectDbSchema, makeDomainsMap, makeFileVersion, makeStructureToAstCtx, migrate, migrateAndClose, migrateFiles, migrationConfigDefaults, promptSelect, rakeDbCommands, rakeDbWithAdapters, saveMigratedVersion, structureToAst, tableToAst, writeMigrationFile };