@bsv/wallet-toolbox-client
Version:
Client only Wallet Storage
39 lines • 1.65 kB
TypeScript
import { Knex } from 'knex';
import { DBType } from '../StorageReader';
import { Chain } from '../../sdk/types';
interface Migration {
up: (knex: Knex) => Promise<void>;
down?: (knex: Knex) => Promise<void>;
config?: object;
}
interface MigrationSource<TMigrationSpec> {
getMigrations(loadExtensions: readonly string[]): Promise<TMigrationSpec[]>;
getMigrationName(migration: TMigrationSpec): string;
getMigration(migration: TMigrationSpec): Promise<Migration>;
}
export declare class KnexMigrations implements MigrationSource<string> {
chain: Chain;
storageName: string;
storageIdentityKey: string;
maxOutputScriptLength: number;
migrations: Record<string, Migration>;
/**
* @param chain
* @param storageName human readable name for this storage instance
* @param maxOutputScriptLength limit for scripts kept in outputs table, longer scripts will be pulled from rawTx
*/
constructor(chain: Chain, storageName: string, storageIdentityKey: string, maxOutputScriptLength: number);
getMigrations(): Promise<string[]>;
getMigrationName(migration: string): string;
getMigration(migration: string): Promise<Migration>;
getLatestMigration(): Promise<string>;
static latestMigration(): Promise<string>;
setupMigrations(chain: string, storageName: string, storageIdentityKey: string, maxOutputScriptLength: number): Record<string, Migration>;
}
/**
* @param knex
* @returns {DBType} connected database engine variant
*/
export declare function determineDBType(knex: Knex<any, any[]>): Promise<DBType>;
export {};
//# sourceMappingURL=KnexMigrations.d.ts.map