/** * @typedef {object} MigrateOptions * @property {string} migrationsDirectory The directory from which to read migration * files * @property {number} uniqueLockNumber Unique migration lock value, preventing * race-conditions while running the migrations */ /** * @typedef {object} MigrationFile * @property {number} number * @property {boolean} repeatable * @property {string} name * @property {string} fullPath * @property {boolean} isMigrated * @property {string} source * @property {string} hash */ /** * @typedef {object} MigrateContext * @property {MigrateOptions} options * @property {Array} files * @property {import("postgres").Sql<{}>} sql * @property {any|undefined} [rebuild] * @property {any|undefined} [info] * @property {any|undefined} [do] * @property {Record} storedHashes * @property {boolean} [missingMigrationTable] */ /** * Create a new migration context, resolves all migration files * * @since 0.1.0 * * @param {import("postgres").Sql<{}>} sql * @param {Partial} [migrateOptions] * @returns {Promise} */ export function migrationsInitContext(sql: import("postgres").Sql<{}>, migrateOptions?: Partial): Promise; /** * Get the migrations to be applied from the provided migration context. * Note that 'repeatable' migrations are always in both the `migrationQueue` and * `hashChanges`. * * @since 0.1.0 * * @param {MigrateContext} mc * @returns {Promise<{ * migrationQueue: Array<{ * name: string, * number: number, * repeatable: boolean * }>, * hashChanges: Array<{ * name: string, * number: number, * }> * }>} */ export function migrationsGetInfo(mc: MigrateContext): Promise<{ migrationQueue: Array<{ name: string; number: number; repeatable: boolean; }>; hashChanges: Array<{ name: string; number: number; }>; }>; /** * Run the migrations currently pending in the migration context. * * @since 0.1.0 * * @param {MigrateContext} mc * @returns {Promise} */ export function migrationsRun(mc: MigrateContext): Promise; /** * Rebuild migration table state based on the known migration files * * @since 0.1.0 * * @param {MigrateContext} mc * @returns {Promise} */ export function migrationsRebuildState(mc: MigrateContext): Promise; export type MigrateOptions = { /** * The directory from which to read migration * files */ migrationsDirectory: string; /** * Unique migration lock value, preventing * race-conditions while running the migrations */ uniqueLockNumber: number; }; export type MigrationFile = { number: number; repeatable: boolean; name: string; fullPath: string; isMigrated: boolean; source: string; hash: string; }; export type MigrateContext = { options: MigrateOptions; files: Array; sql: import("postgres").Sql<{}>; rebuild?: any | undefined; info?: any | undefined; do?: any | undefined; storedHashes: Record; missingMigrationTable?: boolean | undefined; };