Merge pull request #19181 from oktapodia/fix/sequelize-addIndex-typings

@types/sequelize Fix addIndex typing
This commit is contained in:
Bowden Kelly
2017-08-23 17:28:41 -07:00
committed by GitHub
2 changed files with 35 additions and 1 deletions
+34 -1
View File
@@ -5,6 +5,7 @@
// Ivan Drinchev <https://github.com/drinchev>
// Brendan Abolivier <https://github.com/babolivier>
// Patsakol Tangjitcharoenchai <https://github.com/kukoo1>
// Sebastien Bramille <https://github.com/oktapodia>
// Nick Mueller <https://github.com/morpheusxaut>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -4176,7 +4177,7 @@ declare namespace sequelize {
/**
* Adds a new index to a table
*/
addIndex(tableName: string | Object, attributes: string[], options?: QueryOptions,
addIndex(tableName: string | Object, attributes: string[], options?: DefineIndexOptions,
rawTablename?: string): Promise<void>;
/**
@@ -4826,6 +4827,38 @@ declare namespace sequelize {
}
interface DefineIndexOptions {
/**
* The index type
*/
indicesType?: 'UNIQUE' | 'FULLTEXT' | 'SPATIAL';
/**
* The name of the index. Default is __
*/
indexName?: string;
/**
* For FULLTEXT columns set your parser
*/
parser?: string;
/**
* Set a type for the index, e.g. BTREE. See the documentation of the used dialect
*/
indexType?: string;
/**
* A function that receives the sql query, e.g. console.log
*/
logging?: Function;
/**
* A hash of attributes to limit your index(Filtered Indexes - MSSQL & PostgreSQL only)
*/
where?: AnyWhereOptions;
}
/**
* Interface for indexes property in DefineOptions
*
+1
View File
@@ -1091,6 +1091,7 @@ queryInterface.createTable( 'table', { name : { type : Sequelize.STRING } }, { s
queryInterface.addIndex( { schema : 'a', tableName : 'c' }, ['d', 'e'], { logging : function() {} }, 'schema_table' );
queryInterface.showIndex( { schema : 'schema', tableName : 'table' }, { logging : function() {} } );
queryInterface.addIndex( 'Group', ['from'] );
queryInterface.addIndex( 'Group', ['from'], { indexName: 'group_from' } );
queryInterface.describeTable( '_Users', { logging : function() {} } );
queryInterface.createTable( 's', { table_id : { type : Sequelize.INTEGER, primaryKey : true, autoIncrement : true } } );
/* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590