不要怂,就是干,撸起袖子干!

Commit 39269912 by Mirko Jotic Committed by Sushant

fix(types): add using & operator index interface (#10813)

1 parent e3d6795d
Showing with 26 additions and 1 deletions
...@@ -1117,6 +1117,16 @@ export interface ModelIndexesOptions { ...@@ -1117,6 +1117,16 @@ export interface ModelIndexesOptions {
* should be sorted in), `collate` (the collation (sort order) for the column) * should be sorted in), `collate` (the collation (sort order) for the column)
*/ */
fields?: (string | { attribute: string; length: number; order: string; collate: string })[]; 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;
} }
/** /**
......
import { Association, HasOne, Model } from 'sequelize'; import { Association, HasOne, Model, Sequelize, DataTypes } from 'sequelize';
class MyModel extends Model { class MyModel extends Model {
public static associations: { public static associations: {
...@@ -10,3 +10,17 @@ class MyModel extends Model { ...@@ -10,3 +10,17 @@ class MyModel extends Model {
} }
const assoc: Association = MyModel.associations.other; 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'
});
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!