mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
31 lines
922 B
TypeScript
31 lines
922 B
TypeScript
// Type definitions for anydb-sql-migrations
|
|
// Project: https://github.com/spion/anydb-sql-migrations
|
|
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.3
|
|
|
|
import Promise = require('bluebird');
|
|
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
|
|
export interface Migration {
|
|
version: string;
|
|
}
|
|
export interface MigrationsTable extends Table<Migration> {
|
|
version: Column<string>;
|
|
}
|
|
export interface MigFn {
|
|
(tx: Transaction): Promise<any>;
|
|
}
|
|
export interface MigrationTask {
|
|
up: MigFn;
|
|
down: MigFn;
|
|
name: string;
|
|
}
|
|
export declare function create(db: AnydbSql, tasks: string | MigrationTask[]): {
|
|
run: () => Promise<any>;
|
|
migrateTo: (target?: string) => Promise<any>;
|
|
check: (f: (m: {
|
|
type: string;
|
|
items: MigrationTask[];
|
|
}) => any) => Promise<any>;
|
|
};
|