mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Added type definition for Knex.Migration (#9227)
* Added type definition for Knex.Migration Signed-off-by: Emanuel Henrique do Prado <emanuel@tls.inf.br> * Corrected Knex test according documentation (http://knexjs.org/#Migrations-currentVersion) * Change name Migration to Migrator, according the original source
This commit is contained in:
committed by
Masahiro Wakame
parent
3d51112b02
commit
bc5a137b59
@@ -594,8 +594,8 @@ knex.migrate.latest();
|
||||
knex.migrate.rollback(config);
|
||||
knex.migrate.rollback();
|
||||
|
||||
knex.migrate.currentversion(config);
|
||||
knex.migrate.currentversion();
|
||||
knex.migrate.currentVersion(config);
|
||||
knex.migrate.currentVersion();
|
||||
|
||||
knex.seed.make(name, config);
|
||||
knex.seed.make(name);
|
||||
|
||||
20
knex/knex.d.ts
vendored
20
knex/knex.d.ts
vendored
@@ -28,7 +28,7 @@ declare module "knex" {
|
||||
schema: Knex.SchemaBuilder;
|
||||
|
||||
client: any;
|
||||
migrate: any;
|
||||
migrate: Knex.Migrator;
|
||||
seed: any;
|
||||
fn: any;
|
||||
}
|
||||
@@ -370,15 +370,15 @@ declare module "knex" {
|
||||
nullable(): ColumnBuilder;
|
||||
comment(value: string): ColumnBuilder;
|
||||
}
|
||||
|
||||
|
||||
interface ForeignConstraintBuilder {
|
||||
references(columnName: string): ReferencingColumnBuilder;
|
||||
}
|
||||
|
||||
|
||||
interface MultikeyForeignConstraintBuilder {
|
||||
references(columnNames: string[]): ReferencingColumnBuilder;
|
||||
}
|
||||
|
||||
|
||||
interface PostgreSqlColumnBuilder extends ColumnBuilder {
|
||||
index(indexName?: string, indexType?: string): ColumnBuilder;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ declare module "knex" {
|
||||
connection?: string|ConnectionConfig|MariaSqlConnectionConfig|
|
||||
Sqlite3ConnectionConfig|SocketConnectionConfig;
|
||||
pool?: PoolConfig;
|
||||
migrations?: MigrationConfig;
|
||||
migrations?: MigratorConfig;
|
||||
}
|
||||
|
||||
interface ConnectionConfig {
|
||||
@@ -487,12 +487,20 @@ declare module "knex" {
|
||||
log?: boolean;
|
||||
}
|
||||
|
||||
interface MigrationConfig {
|
||||
interface MigratorConfig {
|
||||
database?: string;
|
||||
directory?: string;
|
||||
extension?: string;
|
||||
tableName?: string;
|
||||
}
|
||||
|
||||
interface Migrator {
|
||||
make(name:string, config?: MigratorConfig):Promise<string>;
|
||||
latest(config?: MigratorConfig):Promise<any>;
|
||||
rollback(config?: MigratorConfig):Promise<any>;
|
||||
status(config?: MigratorConfig):Promise<number>;
|
||||
currentVersion(config?: MigratorConfig):Promise<string>;
|
||||
}
|
||||
}
|
||||
|
||||
export = Knex;
|
||||
|
||||
Reference in New Issue
Block a user