mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
added definitions for anydb-sql and anydb-sql-migrations
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
/// <reference path="anydb-sql-migrations" />
|
||||
import anydbsql = require('anydb-sql');
|
||||
import { Table, Column } from 'anydb-sql'
|
||||
import migrator = require('anydb-sql-migrations');
|
||||
|
||||
function do_not_run() {
|
||||
|
||||
var db = anydbsql({
|
||||
url: 'postgres://user:pass@host:port/database',
|
||||
connections: { min: 2, max: 20 }
|
||||
});
|
||||
|
||||
migrator
|
||||
.create(db, '/path/to/migrations/dir')
|
||||
.run();
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// 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
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
|
||||
declare module "anydb-sql-migrations" {
|
||||
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 function create(db: AnydbSql, tasks: any): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
type: string;
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user