From d5a5da8e7fa4bebdb9e86aee99db26c788c026a3 Mon Sep 17 00:00:00 2001 From: Botik Date: Wed, 10 May 2017 14:43:02 +0300 Subject: [PATCH] [sequelize] add where option to DefineIndexesOptions for v4 --- types/sequelize/index.d.ts | 9 +++++++-- types/sequelize/sequelize-tests.ts | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index a7f5b0afe5..503c319768 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3247,8 +3247,8 @@ declare namespace sequelize { * https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group */ group?: string | string[] | Object; - - + + /** * Apply DISTINCT(col) for FindAndCount(all) */ @@ -4784,6 +4784,11 @@ declare namespace sequelize { */ operator?: string; + /** + * Condition for partioal index + */ + where?: WhereOptions; + } /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index cc4462fa86..de24440f72 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1285,7 +1285,10 @@ s.define( 'UserWithUniqueUsername', { name : 'user_and_email_index', unique : true, method : 'BTREE', - fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }] + fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }], + where : { + user_id : { $not: null } + } }, { fields: ['data'],