Skip to content

Commit

Permalink
fix(types): add using & operator index interface (#10813)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkojotic authored and sushantdhiman committed Apr 20, 2019
1 parent e3d6795 commit 3926991
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions types/lib/model.d.ts
Expand Up @@ -1117,6 +1117,16 @@ export interface ModelIndexesOptions {
* should be sorted in), `collate` (the collation (sort order) for the column)
*/
fields?: (string | { attribute: string; length: number; order: string; collate: string })[];

/**
* Type of search index. Postgres only
*/
using?: string;

/**
* Index operator type. Postgres only
*/
operator?: string;
}

/**
Expand Down
16 changes: 15 additions & 1 deletion types/test/model.ts
@@ -1,4 +1,4 @@
import { Association, HasOne, Model } from 'sequelize';
import { Association, HasOne, Model, Sequelize, DataTypes } from 'sequelize';

class MyModel extends Model {
public static associations: {
Expand All @@ -10,3 +10,17 @@ class MyModel extends Model {
}

const assoc: Association = MyModel.associations.other;

const sequelize = new Sequelize('mysql://user:user@localhost:3306/mydb');

MyModel.init({}, {
indexes: [
{
fields: ['foo'],
using: 'gin',
operator: 'jsonb_path_ops',
}
],
sequelize,
tableName: 'my_model'
});

0 comments on commit 3926991

Please sign in to comment.