merged changes for Nick Mueller <https://github.com/morpheusxaut> from v3 to v4

Tickets:

* https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19014
This commit is contained in:
Meykel Gruel
2017-08-16 11:16:32 +02:00
parent 5002dcc843
commit e64381c9e8
2 changed files with 36 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
// Ivan Drinchev <https://github.com/drinchev>
// Brendan Abolivier <https://github.com/babolivier>
// Patsakol Tangjitcharoenchai <https://github.com/kukoo1>
// Nick Mueller <https://github.com/morpheusxaut>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -4868,7 +4869,7 @@ declare namespace sequelize {
* (field name), `length` (create a prefix index of length chars), `order` (the direction the column
* should be sorted in), `collate` (the collation (sort order) for the column)
*/
fields?: Array<string | { attribute: string, length: number, order: string, collate: string }>;
fields?: Array<string | fn | { attribute: string, length: number, order: string, collate: string }>;
/**
* Method the index should use, for example 'gin' index.

View File

@@ -1627,6 +1627,40 @@ s.define( 'TriggerTest', {
hasTrigger : true
} );
s.define('DefineOptionsIndexesTest', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
validate: {
min: 1
}
},
email: {
allowNull: false,
type: Sequelize.STRING(255),
set: function (val) {
if (typeof val === "string") {
val = val.toLowerCase();
} else {
throw new Error("email must be a string");
}
this.setDataValue("email", val);
}
}
}, {
timestamps: false,
indexes: [
{
name: "DefineOptionsIndexesTest_lower_email",
unique: true,
fields: [
Sequelize.fn("LOWER", Sequelize.col("email"))
]
}
]
} );
//
// Transaction
// ~~~~~~~~~~~~~