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

Commit 73b1246a by Simon Schick

refactor: updates

1 parent 7745bc2f
...@@ -369,8 +369,8 @@ class BelongsToMany extends Association { ...@@ -369,8 +369,8 @@ class BelongsToMany extends Association {
* {@link Model} for a full explanation of options * {@link Model} for a full explanation of options
* *
* @param {Model} instance instance * @param {Model} instance instance
* @param {Object} [options] find options * @param {object} [options] find options
* @param {Object} [options.where] An optional where clause to limit the associated models * @param {object} [options.where] An optional where clause to limit the associated models
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {string} [options.schema] Apply a schema on the related model * @param {string} [options.schema] Apply a schema on the related model
* *
...@@ -438,8 +438,8 @@ class BelongsToMany extends Association { ...@@ -438,8 +438,8 @@ class BelongsToMany extends Association {
* Count everything currently associated with this, using an optional where clause. * Count everything currently associated with this, using an optional where clause.
* *
* @param {Model} instance instance * @param {Model} instance instance
* @param {Object} [options] find options * @param {object} [options] find options
* @param {Object} [options.where] An optional where clause to limit the associated models * @param {object} [options.where] An optional where clause to limit the associated models
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* *
* @returns {Promise<number>} * @returns {Promise<number>}
...@@ -464,7 +464,7 @@ class BelongsToMany extends Association { ...@@ -464,7 +464,7 @@ class BelongsToMany extends Association {
* *
* @param {Model} sourceInstance source instance to check for an association with * @param {Model} sourceInstance source instance to check for an association with
* @param {Model|Model[]|string[]|string|number[]|number} [instances] Can be an array of instances or their primary keys * @param {Model|Model[]|string[]|string|number[]|number} [instances] Can be an array of instances or their primary keys
* @param {Object} [options] Options passed to getAssociations * @param {object} [options] Options passed to getAssociations
* *
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
...@@ -508,9 +508,9 @@ class BelongsToMany extends Association { ...@@ -508,9 +508,9 @@ class BelongsToMany extends Association {
* *
* @param {Model} sourceInstance source instance to associate new instances with * @param {Model} sourceInstance source instance to associate new instances with
* @param {Model|Model[]|string[]|string|number[]|number} [newAssociatedObjects] A single instance or primary key, or a mixed array of persisted instances or primary keys * @param {Model|Model[]|string[]|string|number[]|number} [newAssociatedObjects] A single instance or primary key, or a mixed array of persisted instances or primary keys
* @param {Object} [options] Options passed to `through.findAll`, `bulkCreate`, `update` and `destroy` * @param {object} [options] Options passed to `through.findAll`, `bulkCreate`, `update` and `destroy`
* @param {Object} [options.validate] Run validation for the join model * @param {object} [options.validate] Run validation for the join model
* @param {Object} [options.through] Additional attributes for the join table. * @param {object} [options.through] Additional attributes for the join table.
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -611,9 +611,9 @@ class BelongsToMany extends Association { ...@@ -611,9 +611,9 @@ class BelongsToMany extends Association {
* *
* @param {Model} sourceInstance source instance to associate new instances with * @param {Model} sourceInstance source instance to associate new instances with
* @param {Model|Model[]|string[]|string|number[]|number} [newInstances] A single instance or primary key, or a mixed array of persisted instances or primary keys * @param {Model|Model[]|string[]|string|number[]|number} [newInstances] A single instance or primary key, or a mixed array of persisted instances or primary keys
* @param {Object} [options] Options passed to `through.findAll`, `bulkCreate` and `update` * @param {object} [options] Options passed to `through.findAll`, `bulkCreate` and `update`
* @param {Object} [options.validate] Run validation for the join model. * @param {object} [options.validate] Run validation for the join model.
* @param {Object} [options.through] Additional attributes for the join table. * @param {object} [options.through] Additional attributes for the join table.
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -700,7 +700,7 @@ class BelongsToMany extends Association { ...@@ -700,7 +700,7 @@ class BelongsToMany extends Association {
* *
* @param {Model} sourceInstance instance to un associate instances with * @param {Model} sourceInstance instance to un associate instances with
* @param {Model|Model[]|string|string[]|number|number[]} [oldAssociatedObjects] Can be an Instance or its primary key, or a mixed array of instances and primary keys * @param {Model|Model[]|string|string[]|number|number[]} [oldAssociatedObjects] Can be an Instance or its primary key, or a mixed array of instances and primary keys
* @param {Object} [options] Options passed to `through.destroy` * @param {object} [options] Options passed to `through.destroy`
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -719,9 +719,9 @@ class BelongsToMany extends Association { ...@@ -719,9 +719,9 @@ class BelongsToMany extends Association {
* Create a new instance of the associated model and associate it with this. * Create a new instance of the associated model and associate it with this.
* *
* @param {Model} sourceInstance source instance * @param {Model} sourceInstance source instance
* @param {Object} [values] values for target model * @param {object} [values] values for target model
* @param {Object} [options] Options passed to create and add * @param {object} [options] Options passed to create and add
* @param {Object} [options.through] Additional attributes for the join table * @param {object} [options.through] Additional attributes for the join table
* *
* @returns {Promise} * @returns {Promise}
*/ */
......
...@@ -115,7 +115,7 @@ class BelongsTo extends Association { ...@@ -115,7 +115,7 @@ class BelongsTo extends Association {
* Get the associated instance. * Get the associated instance.
* *
* @param {Model|Array<Model>} instances source instances * @param {Model|Array<Model>} instances source instances
* @param {Object} [options] find options * @param {object} [options] find options
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false. * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false.
* @param {string} [options.schema] Apply a schema on the related model * @param {string} [options.schema] Apply a schema on the related model
* *
...@@ -187,7 +187,7 @@ class BelongsTo extends Association { ...@@ -187,7 +187,7 @@ class BelongsTo extends Association {
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {?<Model>|string|number} [associatedInstance] An persisted instance or the primary key of an instance to associate with this. Pass `null` or `undefined` to remove the association. * @param {?<Model>|string|number} [associatedInstance] An persisted instance or the primary key of an instance to associate with this. Pass `null` or `undefined` to remove the association.
* @param {Object} [options={}] options passed to `this.save` * @param {object} [options={}] options passed to `this.save`
* @param {boolean} [options.save=true] Skip saving this after setting the foreign key if false. * @param {boolean} [options.save=true] Skip saving this after setting the foreign key if false.
* *
* @returns {Promise} * @returns {Promise}
...@@ -217,8 +217,8 @@ class BelongsTo extends Association { ...@@ -217,8 +217,8 @@ class BelongsTo extends Association {
* Create a new instance of the associated model and associate it with this. * Create a new instance of the associated model and associate it with this.
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {Object} [values={}] values to create associated model instance with * @param {object} [values={}] values to create associated model instance with
* @param {Object} [options={}] Options passed to `target.create` and setAssociation. * @param {object} [options={}] Options passed to `target.create` and setAssociation.
* *
* @see * @see
* {@link Model#create} for a full explanation of options * {@link Model#create} for a full explanation of options
......
...@@ -159,8 +159,8 @@ class HasMany extends Association { ...@@ -159,8 +159,8 @@ class HasMany extends Association {
* Get everything currently associated with this, using an optional where clause. * Get everything currently associated with this, using an optional where clause.
* *
* @param {Model|Array<Model>} instances source instances * @param {Model|Array<Model>} instances source instances
* @param {Object} [options] find options * @param {object} [options] find options
* @param {Object} [options.where] An optional where clause to limit the associated models * @param {object} [options.where] An optional where clause to limit the associated models
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {string} [options.schema] Apply a schema on the related model * @param {string} [options.schema] Apply a schema on the related model
* *
...@@ -244,8 +244,8 @@ class HasMany extends Association { ...@@ -244,8 +244,8 @@ class HasMany extends Association {
* Count everything currently associated with this, using an optional where clause. * Count everything currently associated with this, using an optional where clause.
* *
* @param {Model} instance the source instance * @param {Model} instance the source instance
* @param {Object} [options] find & count options * @param {object} [options] find & count options
* @param {Object} [options.where] An optional where clause to limit the associated models * @param {object} [options.where] An optional where clause to limit the associated models
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* *
* @returns {Promise<number>} * @returns {Promise<number>}
...@@ -273,7 +273,7 @@ class HasMany extends Association { ...@@ -273,7 +273,7 @@ class HasMany extends Association {
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] Can be an array of instances or their primary keys * @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] Can be an array of instances or their primary keys
* @param {Object} [options] Options passed to getAssociations * @param {object} [options] Options passed to getAssociations
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -314,8 +314,8 @@ class HasMany extends Association { ...@@ -314,8 +314,8 @@ class HasMany extends Association {
* *
* @param {Model} sourceInstance source instance to associate new instances with * @param {Model} sourceInstance source instance to associate new instances with
* @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] An array of persisted instances or primary key of instances to associate with this. Pass `null` or `undefined` to remove all associations. * @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] An array of persisted instances or primary key of instances to associate with this. Pass `null` or `undefined` to remove all associations.
* @param {Object} [options] Options passed to `target.findAll` and `update`. * @param {object} [options] Options passed to `target.findAll` and `update`.
* @param {Object} [options.validate] Run validation for the join model * @param {object} [options.validate] Run validation for the join model
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -395,7 +395,7 @@ class HasMany extends Association { ...@@ -395,7 +395,7 @@ class HasMany extends Association {
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] A single instance or primary key, or a mixed array of persisted instances or primary keys * @param {Model|Model[]|string[]|string|number[]|number} [targetInstances] A single instance or primary key, or a mixed array of persisted instances or primary keys
* @param {Object} [options] Options passed to `target.update`. * @param {object} [options] Options passed to `target.update`.
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -423,7 +423,7 @@ class HasMany extends Association { ...@@ -423,7 +423,7 @@ class HasMany extends Association {
* *
* @param {Model} sourceInstance instance to un associate instances with * @param {Model} sourceInstance instance to un associate instances with
* @param {Model|Model[]|string|string[]|number|number[]} [targetInstances] Can be an Instance or its primary key, or a mixed array of instances and primary keys * @param {Model|Model[]|string|string[]|number|number[]} [targetInstances] Can be an Instance or its primary key, or a mixed array of instances and primary keys
* @param {Object} [options] Options passed to `target.update` * @param {object} [options] Options passed to `target.update`
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -448,8 +448,8 @@ class HasMany extends Association { ...@@ -448,8 +448,8 @@ class HasMany extends Association {
* Create a new instance of the associated model and associate it with this. * Create a new instance of the associated model and associate it with this.
* *
* @param {Model} sourceInstance source instance * @param {Model} sourceInstance source instance
* @param {Object} [values] values for target model instance * @param {object} [values] values for target model instance
* @param {Object} [options] Options passed to `target.create` * @param {object} [options] Options passed to `target.create`
* *
* @returns {Promise} * @returns {Promise}
*/ */
......
...@@ -114,7 +114,7 @@ class HasOne extends Association { ...@@ -114,7 +114,7 @@ class HasOne extends Association {
* Get the associated instance. * Get the associated instance.
* *
* @param {Model|Array<Model>} instances source instances * @param {Model|Array<Model>} instances source instances
* @param {Object} [options] find options * @param {object} [options] find options
* @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false * @param {string|boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {string} [options.schema] Apply a schema on the related model * @param {string} [options.schema] Apply a schema on the related model
* *
...@@ -187,7 +187,7 @@ class HasOne extends Association { ...@@ -187,7 +187,7 @@ class HasOne extends Association {
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {?<Model>|string|number} [associatedInstance] An persisted instance or the primary key of an instance to associate with this. Pass `null` or `undefined` to remove the association. * @param {?<Model>|string|number} [associatedInstance] An persisted instance or the primary key of an instance to associate with this. Pass `null` or `undefined` to remove the association.
* @param {Object} [options] Options passed to getAssociation and `target.save` * @param {object} [options] Options passed to getAssociation and `target.save`
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -236,8 +236,8 @@ class HasOne extends Association { ...@@ -236,8 +236,8 @@ class HasOne extends Association {
* Create a new instance of the associated model and associate it with this. * Create a new instance of the associated model and associate it with this.
* *
* @param {Model} sourceInstance the source instance * @param {Model} sourceInstance the source instance
* @param {Object} [values={}] values to create associated model instance with * @param {object} [values={}] values to create associated model instance with
* @param {Object} [options] Options passed to `target.create` and setAssociation. * @param {object} [options] Options passed to `target.create` and setAssociation.
* *
* @see * @see
* {@link Model#create} for a full explanation of options * {@link Model#create} for a full explanation of options
......
...@@ -46,10 +46,10 @@ exports.addForeignKeyConstraints = addForeignKeyConstraints; ...@@ -46,10 +46,10 @@ exports.addForeignKeyConstraints = addForeignKeyConstraints;
* *
* @private * @private
* *
* @param {Object} association instance * @param {object} association instance
* @param {Object} obj Model prototype * @param {object} obj Model prototype
* @param {Array} methods Method names to inject * @param {Array} methods Method names to inject
* @param {Object} aliases Mapping between model and association method names * @param {object} aliases Mapping between model and association method names
* *
*/ */
function mixinMethods(association, obj, methods, aliases = {}) { function mixinMethods(association, obj, methods, aliases = {}) {
......
...@@ -157,7 +157,7 @@ class CITEXT extends ABSTRACT { ...@@ -157,7 +157,7 @@ class CITEXT extends ABSTRACT {
*/ */
class NUMBER extends ABSTRACT { class NUMBER extends ABSTRACT {
/** /**
* @param {Object} options type options * @param {object} options type options
* @param {string|number} [options.length] length of type, like `INT(4)` * @param {string|number} [options.length] length of type, like `INT(4)`
* @param {boolean} [options.zerofill] Is zero filled? * @param {boolean} [options.zerofill] Is zero filled?
* @param {boolean} [options.unsigned] Is unsigned? * @param {boolean} [options.unsigned] Is unsigned?
......
...@@ -65,7 +65,7 @@ class ConnectionManager { ...@@ -65,7 +65,7 @@ class ConnectionManager {
* @param {string} moduleName Name of dialect module to lookup * @param {string} moduleName Name of dialect module to lookup
* *
* @private * @private
* @returns {Object} * @returns {object}
*/ */
_loadDialectModule(moduleName) { _loadDialectModule(moduleName) {
try { try {
...@@ -249,7 +249,7 @@ class ConnectionManager { ...@@ -249,7 +249,7 @@ class ConnectionManager {
* Get connection from pool. It sets database version if it's not already set. * Get connection from pool. It sets database version if it's not already set.
* Call pool.acquire to get a connection * Call pool.acquire to get a connection
* *
* @param {Object} [options] Pool options * @param {object} [options] Pool options
* @param {string} [options.type] Set which replica to use. Available options are `read` and `write` * @param {string} [options.type] Set which replica to use. Available options are `read` and `write`
* @param {boolean} [options.useMaster=false] Force master or write replica to get connection from * @param {boolean} [options.useMaster=false] Force master or write replica to get connection from
* *
......
...@@ -92,9 +92,9 @@ class QueryGenerator { ...@@ -92,9 +92,9 @@ class QueryGenerator {
* Returns an insert into command * Returns an insert into command
* *
* @param {string} table * @param {string} table
* @param {Object} valueHash attribute value pairs * @param {object} valueHash attribute value pairs
* @param {Object} modelAttributes * @param {object} modelAttributes
* @param {Object} [options] * @param {object} [options]
* *
* @private * @private
*/ */
...@@ -253,9 +253,9 @@ class QueryGenerator { ...@@ -253,9 +253,9 @@ class QueryGenerator {
* Returns an insert into command for multiple values. * Returns an insert into command for multiple values.
* *
* @param {string} tableName * @param {string} tableName
* @param {Object} fieldValueHashes * @param {object} fieldValueHashes
* @param {Object} options * @param {object} options
* @param {Object} fieldMappedAttributes * @param {object} fieldMappedAttributes
* *
* @private * @private
*/ */
...@@ -313,10 +313,10 @@ class QueryGenerator { ...@@ -313,10 +313,10 @@ class QueryGenerator {
* Returns an update query * Returns an update query
* *
* @param {string} tableName * @param {string} tableName
* @param {Object} attrValueHash * @param {object} attrValueHash
* @param {Object} where A hash with conditions (e.g. {name: 'foo'}) OR an ID as integer * @param {object} where A hash with conditions (e.g. {name: 'foo'}) OR an ID as integer
* @param {Object} options * @param {object} options
* @param {Object} attributes * @param {object} attributes
* *
* @private * @private
*/ */
...@@ -427,10 +427,10 @@ class QueryGenerator { ...@@ -427,10 +427,10 @@ class QueryGenerator {
* *
* @param {string} operator String with the arithmetic operator (e.g. '+' or '-') * @param {string} operator String with the arithmetic operator (e.g. '+' or '-')
* @param {string} tableName Name of the table * @param {string} tableName Name of the table
* @param {Object} attrValueHash A hash with attribute-value-pairs * @param {object} attrValueHash A hash with attribute-value-pairs
* @param {Object} where A hash with conditions (e.g. {name: 'foo'}) OR an ID as integer * @param {object} where A hash with conditions (e.g. {name: 'foo'}) OR an ID as integer
* @param {Object} options * @param {object} options
* @param {Object} attributes * @param {object} attributes
*/ */
arithmeticQuery(operator, tableName, attrValueHash, where, options, attributes = {}) { arithmeticQuery(operator, tableName, attrValueHash, where, options, attributes = {}) {
options = { options = {
...@@ -896,7 +896,7 @@ class QueryGenerator { ...@@ -896,7 +896,7 @@ class QueryGenerator {
/** /**
* Quote table name with optional alias and schema attribution * Quote table name with optional alias and schema attribution
* *
* @param {string|Object} param table string or object * @param {string|object} param table string or object
* @param {string|boolean} alias alias name * @param {string|boolean} alias alias name
* *
* @returns {string} * @returns {string}
...@@ -1917,7 +1917,7 @@ class QueryGenerator { ...@@ -1917,7 +1917,7 @@ class QueryGenerator {
/** /**
* Returns an SQL fragment for adding result constraints. * Returns an SQL fragment for adding result constraints.
* *
* @param {Object} options An object with selectQuery options. * @param {object} options An object with selectQuery options.
* @returns {string} The generated sql query. * @returns {string} The generated sql query.
* @private * @private
*/ */
......
...@@ -25,7 +25,7 @@ const postgresReservedWords = 'all,analyse,analyze,and,any,array,as,asc,asymmetr ...@@ -25,7 +25,7 @@ const postgresReservedWords = 'all,analyse,analyze,and,any,array,as,asc,asymmetr
* *
* @param {string} dialect Dialect name * @param {string} dialect Dialect name
* @param {string} identifier Identifier to quote * @param {string} identifier Identifier to quote
* @param {Object} [options] * @param {object} [options]
* @param {boolean} [options.force=false] * @param {boolean} [options.force=false]
* @param {boolean} [options.quoteIdentifiers=true] * @param {boolean} [options.quoteIdentifiers=true]
* *
......
...@@ -7,7 +7,7 @@ const TransactionQueries = { ...@@ -7,7 +7,7 @@ const TransactionQueries = {
* Returns a query that sets the transaction isolation level. * Returns a query that sets the transaction isolation level.
* *
* @param {string} value The isolation level. * @param {string} value The isolation level.
* @param {Object} options An object with options. * @param {object} options An object with options.
* @returns {string} The generated sql query. * @returns {string} The generated sql query.
* @private * @private
*/ */
......
...@@ -38,10 +38,10 @@ class AbstractQuery { ...@@ -38,10 +38,10 @@ class AbstractQuery {
* skipValueReplace: bool, do not replace (but do unescape $$). Check correct syntax and if all values are available * skipValueReplace: bool, do not replace (but do unescape $$). Check correct syntax and if all values are available
* *
* @param {string} sql * @param {string} sql
* @param {Object|Array} values * @param {object|Array} values
* @param {string} dialect * @param {string} dialect
* @param {Function} [replacementFunc] * @param {Function} [replacementFunc]
* @param {Object} [options] * @param {object} [options]
* @private * @private
*/ */
static formatBindParameters(sql, values, dialect, replacementFunc, options = {}) { static formatBindParameters(sql, values, dialect, replacementFunc, options = {}) {
...@@ -382,8 +382,8 @@ class AbstractQuery { ...@@ -382,8 +382,8 @@ class AbstractQuery {
* ] * ]
* *
* @param {Array} rows * @param {Array} rows
* @param {Object} includeOptions * @param {object} includeOptions
* @param {Object} options * @param {object} options
* @private * @private
*/ */
static _groupJoinData(rows, includeOptions, options) { static _groupJoinData(rows, includeOptions, options) {
......
...@@ -33,7 +33,7 @@ class ConnectionManager extends AbstractConnectionManager { ...@@ -33,7 +33,7 @@ class ConnectionManager extends AbstractConnectionManager {
* Set the pool handlers on connection.error * Set the pool handlers on connection.error
* Also set proper timezone once connection is connected. * Also set proper timezone once connection is connected.
* *
* @param {Object} config * @param {object} config
* @returns {Promise<Connection>} * @returns {Promise<Connection>}
* @private * @private
*/ */
......
...@@ -8,7 +8,7 @@ module.exports = BaseTypes => { ...@@ -8,7 +8,7 @@ module.exports = BaseTypes => {
/** /**
* Removes unsupported MSSQL options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types. * Removes unsupported MSSQL options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
* *
* @param {Object} dataType The base integer data type. * @param {object} dataType The base integer data type.
* @private * @private
*/ */
function removeUnsupportedIntegerOptions(dataType) { function removeUnsupportedIntegerOptions(dataType) {
......
...@@ -695,7 +695,7 @@ class MSSQLQueryGenerator extends AbstractQueryGenerator { ...@@ -695,7 +695,7 @@ class MSSQLQueryGenerator extends AbstractQueryGenerator {
/** /**
* Generates an SQL query that returns all foreign keys details of a table. * Generates an SQL query that returns all foreign keys details of a table.
* *
* @param {string|Object} table * @param {string|object} table
* @param {string} catalogName database name * @param {string} catalogName database name
* @returns {string} * @returns {string}
*/ */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
@param {QueryInterface} qi @param {QueryInterface} qi
@param {string} tableName The name of the table. @param {string} tableName The name of the table.
@param {string} attributeName The name of the attribute that we want to remove. @param {string} attributeName The name of the attribute that we want to remove.
@param {Object} options @param {object} options
@param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries @param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries
@private @private
......
...@@ -33,7 +33,7 @@ class ConnectionManager extends AbstractConnectionManager { ...@@ -33,7 +33,7 @@ class ConnectionManager extends AbstractConnectionManager {
* Set the pool handlers on connection.error * Set the pool handlers on connection.error
* Also set proper timezone once connection is connected. * Also set proper timezone once connection is connected.
* *
* @param {Object} config * @param {object} config
* @returns {Promise<Connection>} * @returns {Promise<Connection>}
* @private * @private
*/ */
......
...@@ -499,7 +499,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator { ...@@ -499,7 +499,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator {
/** /**
* Generates an SQL query that returns all foreign keys of a table. * Generates an SQL query that returns all foreign keys of a table.
* *
* @param {Object} table The table. * @param {object} table The table.
* @param {string} schemaName The name of the schema. * @param {string} schemaName The name of the schema.
* @returns {string} The generated sql query. * @returns {string} The generated sql query.
* @private * @private
...@@ -512,7 +512,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator { ...@@ -512,7 +512,7 @@ class MySQLQueryGenerator extends AbstractQueryGenerator {
/** /**
* Generates an SQL query that returns the foreign key constraint of a given column. * Generates an SQL query that returns the foreign key constraint of a given column.
* *
* @param {Object} table The table. * @param {object} table The table.
* @param {string} columnName The name of the column. * @param {string} columnName The name of the column.
* @returns {string} The generated sql query. * @returns {string} The generated sql query.
* @private * @private
......
...@@ -17,7 +17,7 @@ const sequelizeErrors = require('../../errors'); ...@@ -17,7 +17,7 @@ const sequelizeErrors = require('../../errors');
@param {QueryInterface} qi @param {QueryInterface} qi
@param {string} tableName The name of the table. @param {string} tableName The name of the table.
@param {string} columnName The name of the attribute that we want to remove. @param {string} columnName The name of the attribute that we want to remove.
@param {Object} options @param {object} options
@private @private
*/ */
...@@ -50,7 +50,7 @@ function removeColumn(qi, tableName, columnName, options = {}) { ...@@ -50,7 +50,7 @@ function removeColumn(qi, tableName, columnName, options = {}) {
* @param {QueryInterface} qi * @param {QueryInterface} qi
* @param {string} tableName * @param {string} tableName
* @param {string} constraintName * @param {string} constraintName
* @param {Object} options * @param {object} options
* *
* @private * @private
*/ */
......
...@@ -9,7 +9,7 @@ module.exports = BaseTypes => { ...@@ -9,7 +9,7 @@ module.exports = BaseTypes => {
/** /**
* Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types. * Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
* *
* @param {Object} dataType The base integer data type. * @param {object} dataType The base integer data type.
* @private * @private
*/ */
function removeUnsupportedIntegerOptions(dataType) { function removeUnsupportedIntegerOptions(dataType) {
......
...@@ -17,8 +17,8 @@ const QueryTypes = require('../../query-types'); ...@@ -17,8 +17,8 @@ const QueryTypes = require('../../query-types');
* *
* @param {QueryInterface} qi * @param {QueryInterface} qi
* @param {string} tableName Name of table to create * @param {string} tableName Name of table to create
* @param {Object} attributes Object representing a list of normalized table attributes * @param {object} attributes Object representing a list of normalized table attributes
* @param {Object} [options] * @param {object} [options]
* @param {Model} [model] * @param {Model} [model]
* *
* @returns {Promise} * @returns {Promise}
......
...@@ -15,7 +15,7 @@ class Query extends AbstractQuery { ...@@ -15,7 +15,7 @@ class Query extends AbstractQuery {
* Rewrite query with parameters. * Rewrite query with parameters.
* *
* @param {string} sql * @param {string} sql
* @param {Array|Object} values * @param {Array|object} values
* @param {string} dialect * @param {string} dialect
* @private * @private
*/ */
......
...@@ -6,7 +6,7 @@ module.exports = BaseTypes => { ...@@ -6,7 +6,7 @@ module.exports = BaseTypes => {
/** /**
* Removes unsupported SQLite options, i.e., UNSIGNED and ZEROFILL, for the integer data types. * Removes unsupported SQLite options, i.e., UNSIGNED and ZEROFILL, for the integer data types.
* *
* @param {Object} dataType The base integer data type. * @param {object} dataType The base integer data type.
* @private * @private
*/ */
function removeUnsupportedIntegerOptions(dataType) { function removeUnsupportedIntegerOptions(dataType) {
......
...@@ -20,7 +20,7 @@ const QueryTypes = require('../../query-types'); ...@@ -20,7 +20,7 @@ const QueryTypes = require('../../query-types');
@param {QueryInterface} qi @param {QueryInterface} qi
@param {string} tableName The name of the table. @param {string} tableName The name of the table.
@param {string} attributeName The name of the attribute that we want to remove. @param {string} attributeName The name of the attribute that we want to remove.
@param {Object} options @param {object} options
@param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries @param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries
@since 1.6.0 @since 1.6.0
...@@ -45,8 +45,8 @@ exports.removeColumn = removeColumn; ...@@ -45,8 +45,8 @@ exports.removeColumn = removeColumn;
@param {QueryInterface} qi @param {QueryInterface} qi
@param {string} tableName The name of the table. @param {string} tableName The name of the table.
@param {Object} attributes An object with the attribute's name as key and its options as value object. @param {object} attributes An object with the attribute's name as key and its options as value object.
@param {Object} options @param {object} options
@param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries @param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries
@since 1.6.0 @since 1.6.0
...@@ -74,7 +74,7 @@ exports.changeColumn = changeColumn; ...@@ -74,7 +74,7 @@ exports.changeColumn = changeColumn;
@param {string} tableName The name of the table. @param {string} tableName The name of the table.
@param {string} attrNameBefore The name of the attribute before it was renamed. @param {string} attrNameBefore The name of the attribute before it was renamed.
@param {string} attrNameAfter The name of the attribute after it was renamed. @param {string} attrNameAfter The name of the attribute after it was renamed.
@param {Object} options @param {object} options
@param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries @param {boolean|Function} [options.logging] A function that logs the sql queries, or false for explicitly not logging these queries
@since 1.6.0 @since 1.6.0
...@@ -97,7 +97,7 @@ exports.renameColumn = renameColumn; ...@@ -97,7 +97,7 @@ exports.renameColumn = renameColumn;
* @param {QueryInterface} qi * @param {QueryInterface} qi
* @param {string} tableName * @param {string} tableName
* @param {string} constraintName * @param {string} constraintName
* @param {Object} options * @param {object} options
* *
* @private * @private
*/ */
...@@ -145,7 +145,7 @@ exports.removeConstraint = removeConstraint; ...@@ -145,7 +145,7 @@ exports.removeConstraint = removeConstraint;
/** /**
* @param {QueryInterface} qi * @param {QueryInterface} qi
* @param {string} tableName * @param {string} tableName
* @param {Object} options * @param {object} options
* *
* @private * @private
*/ */
...@@ -176,7 +176,7 @@ exports.addConstraint = addConstraint; ...@@ -176,7 +176,7 @@ exports.addConstraint = addConstraint;
/** /**
* @param {QueryInterface} qi * @param {QueryInterface} qi
* @param {string} tableName * @param {string} tableName
* @param {Object} options Query Options * @param {object} options Query Options
* *
* @private * @private
* @returns {Promise} * @returns {Promise}
......
...@@ -20,7 +20,7 @@ class Query extends AbstractQuery { ...@@ -20,7 +20,7 @@ class Query extends AbstractQuery {
* rewrite query with parameters. * rewrite query with parameters.
* *
* @param {string} sql * @param {string} sql
* @param {Array|Object} values * @param {Array|object} values
* @param {string} dialect * @param {string} dialect
* @private * @private
*/ */
......
...@@ -7,7 +7,7 @@ const BaseError = require('./base-error'); ...@@ -7,7 +7,7 @@ const BaseError = require('./base-error');
* Used with Promise.AggregateError * Used with Promise.AggregateError
* *
* @param {Error} error Error for a given record/instance * @param {Error} error Error for a given record/instance
* @param {Object} record DAO instance that error belongs to * @param {object} record DAO instance that error belongs to
*/ */
class BulkRecordError extends BaseError { class BulkRecordError extends BaseError {
constructor(error, record) { constructor(error, record) {
......
...@@ -61,8 +61,8 @@ class ValidationErrorItem { ...@@ -61,8 +61,8 @@ class ValidationErrorItem {
* @param {string} type The type/origin of the validation error * @param {string} type The type/origin of the validation error
* @param {string} path The field that triggered the validation error * @param {string} path The field that triggered the validation error
* @param {string} value The value that generated the error * @param {string} value The value that generated the error
* @param {Object} [inst] the DAO instance that caused the validation error * @param {object} [inst] the DAO instance that caused the validation error
* @param {Object} [validatorKey] a validation "key", used for identification * @param {object} [validatorKey] a validation "key", used for identification
* @param {string} [fnName] property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable * @param {string} [fnName] property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable
* @param {string} [fnArgs] parameters used with the BUILT-IN validator function, if applicable * @param {string} [fnArgs] parameters used with the BUILT-IN validator function, if applicable
*/ */
...@@ -179,7 +179,7 @@ class ValidationErrorItem { ...@@ -179,7 +179,7 @@ class ValidationErrorItem {
/** /**
* An enum that defines valid ValidationErrorItem `origin` values * An enum that defines valid ValidationErrorItem `origin` values
* *
* @type {Object} * @type {object}
* @property CORE {string} specifies errors that originate from the sequelize "core" * @property CORE {string} specifies errors that originate from the sequelize "core"
* @property DB {string} specifies validation errors that originate from the storage engine * @property DB {string} specifies validation errors that originate from the storage engine
* @property FUNCTION {string} specifies validation errors that originate from validator functions (both built-in and custom) defined for a given attribute * @property FUNCTION {string} specifies validation errors that originate from validator functions (both built-in and custom) defined for a given attribute
...@@ -195,7 +195,7 @@ ValidationErrorItem.Origins = { ...@@ -195,7 +195,7 @@ ValidationErrorItem.Origins = {
* that maps current `type` strings (as given to ValidationErrorItem.constructor()) to * that maps current `type` strings (as given to ValidationErrorItem.constructor()) to
* our new `origin` values. * our new `origin` values.
* *
* @type {Object} * @type {object}
*/ */
ValidationErrorItem.TypeStringMap = { ValidationErrorItem.TypeStringMap = {
'notnull violation': 'CORE', 'notnull violation': 'CORE',
......
...@@ -73,7 +73,7 @@ const Hooks = { ...@@ -73,7 +73,7 @@ const Hooks = {
/** /**
* Process user supplied hooks definition * Process user supplied hooks definition
* *
* @param {Object} hooks hooks definition * @param {object} hooks hooks definition
* *
* @private * @private
* @memberof Sequelize * @memberof Sequelize
......
...@@ -12,7 +12,7 @@ const validator = require('./utils/validator-extras').validator; ...@@ -12,7 +12,7 @@ const validator = require('./utils/validator-extras').validator;
* Instance Validator. * Instance Validator.
* *
* @param {Instance} modelInstance The model instance. * @param {Instance} modelInstance The model instance.
* @param {Object} options A dictionary with options. * @param {object} options A dictionary with options.
* *
* @private * @private
*/ */
...@@ -281,7 +281,7 @@ class InstanceValidator { ...@@ -281,7 +281,7 @@ class InstanceValidator {
* @param {string} validatorType One of known to Sequelize validators. * @param {string} validatorType One of known to Sequelize validators.
* @param {string} field The field that is being validated * @param {string} field The field that is being validated
* *
* @returns {Object} An object with specific keys to invoke the validator. * @returns {object} An object with specific keys to invoke the validator.
*/ */
_invokeBuiltinValidator(value, test, validatorType, field) { _invokeBuiltinValidator(value, test, validatorType, field) {
return Promise.try(() => { return Promise.try(() => {
...@@ -330,7 +330,7 @@ class InstanceValidator { ...@@ -330,7 +330,7 @@ class InstanceValidator {
/** /**
* Will validate a single field against its schema definition (isnull). * Will validate a single field against its schema definition (isnull).
* *
* @param {Object} rawAttribute As defined in the Schema. * @param {object} rawAttribute As defined in the Schema.
* @param {string} field The field name. * @param {string} field The field name.
* @param {*} value anything. * @param {*} value anything.
* *
......
...@@ -35,7 +35,7 @@ class ModelManager { ...@@ -35,7 +35,7 @@ class ModelManager {
* Will take foreign key constraints into account so that dependencies are visited before dependents. * Will take foreign key constraints into account so that dependencies are visited before dependents.
* *
* @param {Function} iterator method to execute on each model * @param {Function} iterator method to execute on each model
* @param {Object} [options] iterator options * @param {object} [options] iterator options
* @private * @private
*/ */
forEachModel(iterator, options) { forEachModel(iterator, options) {
......
...@@ -77,8 +77,8 @@ class Model { ...@@ -77,8 +77,8 @@ class Model {
/** /**
* Builds a new model instance. * Builds a new model instance.
* *
* @param {Object} [values={}] an object of key value pairs * @param {object} [values={}] an object of key value pairs
* @param {Object} [options] instance construction options * @param {object} [options] instance construction options
* @param {boolean} [options.raw=false] If set to true, values will ignore field and virtual setters. * @param {boolean} [options.raw=false] If set to true, values will ignore field and virtual setters.
* @param {boolean} [options.isNewRecord=true] Is this a new record * @param {boolean} [options.isNewRecord=true] Is this a new record
* @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set` * @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set`
...@@ -860,8 +860,8 @@ class Model { ...@@ -860,8 +860,8 @@ class Model {
* @see * @see
* {@link Hooks} * {@link Hooks}
* *
* @param {Object} attributes An object, where each attribute is a column of the table. Each column can be either a DataType, a string or a type-description object, with the properties described below: * @param {object} attributes An object, where each attribute is a column of the table. Each column can be either a DataType, a string or a type-description object, with the properties described below:
* @param {string|DataTypes|Object} attributes.column The description of a database column * @param {string|DataTypes|object} attributes.column The description of a database column
* @param {string|DataTypes} attributes.column.type A string or a data type * @param {string|DataTypes} attributes.column.type A string or a data type
* @param {boolean} [attributes.column.allowNull=true] If false, the column will have a NOT NULL constraint, and a not null validation will be run before an instance is saved. * @param {boolean} [attributes.column.allowNull=true] If false, the column will have a NOT NULL constraint, and a not null validation will be run before an instance is saved.
* @param {any} [attributes.column.defaultValue=null] A literal default value, a JavaScript function, or an SQL function (see `sequelize.fn`) * @param {any} [attributes.column.defaultValue=null] A literal default value, a JavaScript function, or an SQL function (see `sequelize.fn`)
...@@ -877,28 +877,28 @@ class Model { ...@@ -877,28 +877,28 @@ class Model {
* @param {string} [attributes.column.onDelete] What should happen when the referenced key is deleted. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or NO ACTION * @param {string} [attributes.column.onDelete] What should happen when the referenced key is deleted. One of CASCADE, RESTRICT, SET DEFAULT, SET NULL or NO ACTION
* @param {Function} [attributes.column.get] Provide a custom getter for this column. Use `this.getDataValue(String)` to manipulate the underlying values. * @param {Function} [attributes.column.get] Provide a custom getter for this column. Use `this.getDataValue(String)` to manipulate the underlying values.
* @param {Function} [attributes.column.set] Provide a custom setter for this column. Use `this.setDataValue(String, Value)` to manipulate the underlying values. * @param {Function} [attributes.column.set] Provide a custom setter for this column. Use `this.setDataValue(String, Value)` to manipulate the underlying values.
* @param {Object} [attributes.column.validate] An object of validations to execute for this column every time the model is saved. Can be either the name of a validation provided by validator.js, a validation function provided by extending validator.js (see the `DAOValidator` property for more details), or a custom validation function. Custom validation functions are called with the value of the field and the instance itself as the `this` binding, and can possibly take a second callback argument, to signal that they are asynchronous. If the validator is sync, it should throw in the case of a failed validation; if it is async, the callback should be called with the error text. * @param {object} [attributes.column.validate] An object of validations to execute for this column every time the model is saved. Can be either the name of a validation provided by validator.js, a validation function provided by extending validator.js (see the `DAOValidator` property for more details), or a custom validation function. Custom validation functions are called with the value of the field and the instance itself as the `this` binding, and can possibly take a second callback argument, to signal that they are asynchronous. If the validator is sync, it should throw in the case of a failed validation; if it is async, the callback should be called with the error text.
* @param {Object} options These options are merged with the default define options provided to the Sequelize constructor * @param {object} options These options are merged with the default define options provided to the Sequelize constructor
* @param {Object} options.sequelize Define the sequelize instance to attach to the new Model. Throw error if none is provided. * @param {object} options.sequelize Define the sequelize instance to attach to the new Model. Throw error if none is provided.
* @param {string} [options.modelName] Set name of the model. By default its same as Class name. * @param {string} [options.modelName] Set name of the model. By default its same as Class name.
* @param {Object} [options.defaultScope={}] Define the default search scope to use for this model. Scopes have the same form as the options passed to find / findAll * @param {object} [options.defaultScope={}] Define the default search scope to use for this model. Scopes have the same form as the options passed to find / findAll
* @param {Object} [options.scopes] More scopes, defined in the same way as defaultScope above. See `Model.scope` for more information about how scopes are defined, and what you can do with them * @param {object} [options.scopes] More scopes, defined in the same way as defaultScope above. See `Model.scope` for more information about how scopes are defined, and what you can do with them
* @param {boolean} [options.omitNull] Don't persist null values. This means that all columns with null values will not be saved * @param {boolean} [options.omitNull] Don't persist null values. This means that all columns with null values will not be saved
* @param {boolean} [options.timestamps=true] Adds createdAt and updatedAt timestamps to the model. * @param {boolean} [options.timestamps=true] Adds createdAt and updatedAt timestamps to the model.
* @param {boolean} [options.paranoid=false] Calling `destroy` will not delete the model, but instead set a `deletedAt` timestamp if this is true. Needs `timestamps=true` to work * @param {boolean} [options.paranoid=false] Calling `destroy` will not delete the model, but instead set a `deletedAt` timestamp if this is true. Needs `timestamps=true` to work
* @param {boolean} [options.underscored=false] Add underscored field to all attributes, this covers user defined attributes, timestamps and foreign keys. Will not affect attributes with explicitly set `field` option * @param {boolean} [options.underscored=false] Add underscored field to all attributes, this covers user defined attributes, timestamps and foreign keys. Will not affect attributes with explicitly set `field` option
* @param {boolean} [options.freezeTableName=false] If freezeTableName is true, sequelize will not try to alter the model name to get the table name. Otherwise, the model name will be pluralized * @param {boolean} [options.freezeTableName=false] If freezeTableName is true, sequelize will not try to alter the model name to get the table name. Otherwise, the model name will be pluralized
* @param {Object} [options.name] An object with two attributes, `singular` and `plural`, which are used when this model is associated to others. * @param {object} [options.name] An object with two attributes, `singular` and `plural`, which are used when this model is associated to others.
* @param {string} [options.name.singular=Utils.singularize(modelName)] Singular name for model * @param {string} [options.name.singular=Utils.singularize(modelName)] Singular name for model
* @param {string} [options.name.plural=Utils.pluralize(modelName)] Plural name for model * @param {string} [options.name.plural=Utils.pluralize(modelName)] Plural name for model
* @param {Array<Object>} [options.indexes] indexes definitions * @param {Array<object>} [options.indexes] indexes definitions
* @param {string} [options.indexes[].name] The name of the index. Defaults to model name + _ + fields concatenated * @param {string} [options.indexes[].name] The name of the index. Defaults to model name + _ + fields concatenated
* @param {string} [options.indexes[].type] Index type. Only used by mysql. One of `UNIQUE`, `FULLTEXT` and `SPATIAL` * @param {string} [options.indexes[].type] Index type. Only used by mysql. One of `UNIQUE`, `FULLTEXT` and `SPATIAL`
* @param {string} [options.indexes[].using] The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and postgres, and postgres additionally supports GIST and GIN. * @param {string} [options.indexes[].using] The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and postgres, and postgres additionally supports GIST and GIN.
* @param {string} [options.indexes[].operator] Specify index operator. * @param {string} [options.indexes[].operator] Specify index operator.
* @param {boolean} [options.indexes[].unique=false] Should the index by unique? Can also be triggered by setting type to `UNIQUE` * @param {boolean} [options.indexes[].unique=false] Should the index by unique? Can also be triggered by setting type to `UNIQUE`
* @param {boolean} [options.indexes[].concurrently=false] PostgresSQL will build the index without taking any write locks. Postgres only * @param {boolean} [options.indexes[].concurrently=false] PostgresSQL will build the index without taking any write locks. Postgres only
* @param {Array<string|Object>} [options.indexes[].fields] An array of the fields to index. Each field can either be a string containing the name of the field, a sequelize object (e.g `sequelize.fn`), or an object with the following attributes: `attribute` (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) * @param {Array<string|object>} [options.indexes[].fields] An array of the fields to index. Each field can either be a string containing the name of the field, a sequelize object (e.g `sequelize.fn`), or an object with the following attributes: `attribute` (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)
* @param {string|boolean} [options.createdAt] Override the name of the createdAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting. * @param {string|boolean} [options.createdAt] Override the name of the createdAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting.
* @param {string|boolean} [options.updatedAt] Override the name of the updatedAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting. * @param {string|boolean} [options.updatedAt] Override the name of the updatedAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting.
* @param {string|boolean} [options.deletedAt] Override the name of the deletedAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting. * @param {string|boolean} [options.deletedAt] Override the name of the deletedAt attribute if a string is provided, or disable it if false. Timestamps must be true. Underscored field will be set with underscored setting.
...@@ -909,8 +909,8 @@ class Model { ...@@ -909,8 +909,8 @@ class Model {
* @param {string} [options.comment] Specify comment for model's table * @param {string} [options.comment] Specify comment for model's table
* @param {string} [options.collate] Specify collation for model's table * @param {string} [options.collate] Specify collation for model's table
* @param {string} [options.initialAutoIncrement] Set the initial AUTO_INCREMENT value for the table in MySQL. * @param {string} [options.initialAutoIncrement] Set the initial AUTO_INCREMENT value for the table in MySQL.
* @param {Object} [options.hooks] An object of hook function that are called before and after certain lifecycle events. The possible hooks are: beforeValidate, afterValidate, validationFailed, beforeBulkCreate, beforeBulkDestroy, beforeBulkUpdate, beforeCreate, beforeDestroy, beforeUpdate, afterCreate, beforeSave, afterDestroy, afterUpdate, afterBulkCreate, afterSave, afterBulkDestroy and afterBulkUpdate. See Hooks for more information about hook functions and their signatures. Each property can either be a function, or an array of functions. * @param {object} [options.hooks] An object of hook function that are called before and after certain lifecycle events. The possible hooks are: beforeValidate, afterValidate, validationFailed, beforeBulkCreate, beforeBulkDestroy, beforeBulkUpdate, beforeCreate, beforeDestroy, beforeUpdate, afterCreate, beforeSave, afterDestroy, afterUpdate, afterBulkCreate, afterSave, afterBulkDestroy and afterBulkUpdate. See Hooks for more information about hook functions and their signatures. Each property can either be a function, or an array of functions.
* @param {Object} [options.validate] An object of model wide validations. Validations have access to all model values via `this`. If the validator function takes an argument, it is assumed to be async, and is called with a callback that accepts an optional error. * @param {object} [options.validate] An object of model wide validations. Validations have access to all model values via `this`. If the validator function takes an argument, it is assumed to be async, and is called with a callback that accepts an optional error.
* *
* @returns {Model} * @returns {Model}
*/ */
...@@ -1259,7 +1259,7 @@ class Model { ...@@ -1259,7 +1259,7 @@ class Model {
/** /**
* Sync this Model to the DB, that is create the table. * Sync this Model to the DB, that is create the table.
* *
* @param {Object} [options] sync options * @param {object} [options] sync options
* *
* @see * @see
* {@link Sequelize#sync} for options * {@link Sequelize#sync} for options
...@@ -1369,7 +1369,7 @@ class Model { ...@@ -1369,7 +1369,7 @@ class Model {
/** /**
* Drop the table represented by this Model * Drop the table represented by this Model
* *
* @param {Object} [options] drop options * @param {object} [options] drop options
* @param {boolean} [options.cascade=false] Also drop all objects depending on this table, such as views. Only works in postgres * @param {boolean} [options.cascade=false] Also drop all objects depending on this table, such as views. Only works in postgres
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging). * @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
...@@ -1395,7 +1395,7 @@ class Model { ...@@ -1395,7 +1395,7 @@ class Model {
* for the model. * for the model.
* *
* @param {string} schema The name of the schema * @param {string} schema The name of the schema
* @param {Object} [options] schema options * @param {object} [options] schema options
* @param {string} [options.schemaDelimiter='.'] The character(s) that separates the schema name from the table name * @param {string} [options.schemaDelimiter='.'] The character(s) that separates the schema name from the table name
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging). * @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
...@@ -1427,7 +1427,7 @@ class Model { ...@@ -1427,7 +1427,7 @@ class Model {
* Get the table name of the model, taking schema into account. The method will return The name as a string if the model has no schema, * Get the table name of the model, taking schema into account. The method will return The name as a string if the model has no schema,
* or an object with `tableName`, `schema` and `delimiter` properties. * or an object with `tableName`, `schema` and `delimiter` properties.
* *
* @returns {string|Object} * @returns {string|object}
*/ */
static getTableName() { static getTableName() {
return this.QueryGenerator.addSchema(this); return this.QueryGenerator.addSchema(this);
...@@ -1448,8 +1448,8 @@ class Model { ...@@ -1448,8 +1448,8 @@ class Model {
* By default this will throw an error if a scope with that name already exists. Pass `override: true` in the options object to silence this error. * By default this will throw an error if a scope with that name already exists. Pass `override: true` in the options object to silence this error.
* *
* @param {string} name The name of the scope. Use `defaultScope` to override the default scope * @param {string} name The name of the scope. Use `defaultScope` to override the default scope
* @param {Object|Function} scope scope or options * @param {object|Function} scope scope or options
* @param {Object} [options] scope options * @param {object} [options] scope options
* @param {boolean} [options.override=false] override old scope if already defined * @param {boolean} [options.override=false] override old scope if already defined
*/ */
static addScope(name, scope, options) { static addScope(name, scope, options) {
...@@ -1509,7 +1509,7 @@ class Model { ...@@ -1509,7 +1509,7 @@ class Model {
* Model.scope({ method: ['complexFunction', 'dan@sequelize.com', 42]}).findAll() * Model.scope({ method: ['complexFunction', 'dan@sequelize.com', 42]}).findAll()
* // WHERE email like 'dan@sequelize.com%' AND access_level >= 42 * // WHERE email like 'dan@sequelize.com%' AND access_level >= 42
* *
* @param {?Array|Object|string} [option] The scope(s) to apply. Scopes can either be passed as consecutive arguments, or as an array of arguments. To apply simple scopes and scope functions with no arguments, pass them as strings. For scope function, pass an object, with a `method` property. The value can either be a string, if the method does not take any arguments, or an array, where the first element is the name of the method, and consecutive elements are arguments to that method. Pass null to remove all scopes, including the default. * @param {?Array|object|string} [option] The scope(s) to apply. Scopes can either be passed as consecutive arguments, or as an array of arguments. To apply simple scopes and scope functions with no arguments, pass them as strings. For scope function, pass an object, with a `method` property. The value can either be a string, if the method does not take any arguments, or an array, where the first element is the name of the method, and consecutive elements are arguments to that method. Pass null to remove all scopes, including the default.
* *
* @returns {Model} A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope. * @returns {Model} A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope.
*/ */
...@@ -1630,36 +1630,36 @@ class Model { ...@@ -1630,36 +1630,36 @@ class Model {
* *
* The promise is resolved with an array of Model instances if the query succeeds._ * The promise is resolved with an array of Model instances if the query succeeds._
* *
* @param {Object} [options] A hash of options to describe the scope of the search * @param {object} [options] A hash of options to describe the scope of the search
* @param {Object} [options.where] A hash of attributes to describe your search. See above for examples. * @param {object} [options.where] A hash of attributes to describe your search. See above for examples.
* @param {Array<string>|Object} [options.attributes] A list of the attributes that you want to select, or an object with `include` and `exclude` keys. To rename an attribute, you can pass an array, with two elements - the first is the name of the attribute in the DB (or some kind of expression such as `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to have in the returned instance * @param {Array<string>|object} [options.attributes] A list of the attributes that you want to select, or an object with `include` and `exclude` keys. To rename an attribute, you can pass an array, with two elements - the first is the name of the attribute in the DB (or some kind of expression such as `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to have in the returned instance
* @param {Array<string>} [options.attributes.include] Select all the attributes of the model, plus some additional ones. Useful for aggregations, e.g. `{ attributes: { include: [[sequelize.fn('COUNT', sequelize.col('id')), 'total']] }` * @param {Array<string>} [options.attributes.include] Select all the attributes of the model, plus some additional ones. Useful for aggregations, e.g. `{ attributes: { include: [[sequelize.fn('COUNT', sequelize.col('id')), 'total']] }`
* @param {Array<string>} [options.attributes.exclude] Select all the attributes of the model, except some few. Useful for security purposes e.g. `{ attributes: { exclude: ['password'] } }` * @param {Array<string>} [options.attributes.exclude] Select all the attributes of the model, except some few. Useful for security purposes e.g. `{ attributes: { exclude: ['password'] } }`
* @param {boolean} [options.paranoid=true] If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned. Only applies if `options.paranoid` is true for the model. * @param {boolean} [options.paranoid=true] If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will be returned. Only applies if `options.paranoid` is true for the model.
* @param {Array<Object|Model|string>} [options.include] A list of associations to eagerly load using a left join. Supported is either `{ include: [ Model1, Model2, ...]}` or `{ include: [{ model: Model1, as: 'Alias' }]}` or `{ include: ['Alias']}`. If your association are set up with an `as` (eg. `X.hasMany(Y, { as: 'Z }`, you need to specify Z in the as attribute when eager loading Y). * @param {Array<object|Model|string>} [options.include] A list of associations to eagerly load using a left join. Supported is either `{ include: [ Model1, Model2, ...]}` or `{ include: [{ model: Model1, as: 'Alias' }]}` or `{ include: ['Alias']}`. If your association are set up with an `as` (eg. `X.hasMany(Y, { as: 'Z }`, you need to specify Z in the as attribute when eager loading Y).
* @param {Model} [options.include[].model] The model you want to eagerly load * @param {Model} [options.include[].model] The model you want to eagerly load
* @param {string} [options.include[].as] The alias of the relation, in case the model you want to eagerly load is aliased. For `hasOne` / `belongsTo`, this should be the singular name, and for `hasMany`, it should be the plural * @param {string} [options.include[].as] The alias of the relation, in case the model you want to eagerly load is aliased. For `hasOne` / `belongsTo`, this should be the singular name, and for `hasMany`, it should be the plural
* @param {Association} [options.include[].association] The association you want to eagerly load. (This can be used instead of providing a model/as pair) * @param {Association} [options.include[].association] The association you want to eagerly load. (This can be used instead of providing a model/as pair)
* @param {Object} [options.include[].where] Where clauses to apply to the child models. Note that this converts the eager load to an inner join, unless you explicitly set `required: false` * @param {object} [options.include[].where] Where clauses to apply to the child models. Note that this converts the eager load to an inner join, unless you explicitly set `required: false`
* @param {boolean} [options.include[].or=false] Whether to bind the ON and WHERE clause together by OR instead of AND. * @param {boolean} [options.include[].or=false] Whether to bind the ON and WHERE clause together by OR instead of AND.
* @param {Object} [options.include[].on] Supply your own ON condition for the join. * @param {object} [options.include[].on] Supply your own ON condition for the join.
* @param {Array<string>} [options.include[].attributes] A list of attributes to select from the child model * @param {Array<string>} [options.include[].attributes] A list of attributes to select from the child model
* @param {boolean} [options.include[].required] If true, converts to an inner join, which means that the parent model will only be loaded if it has any matching children. True if `include.where` is set, false otherwise. * @param {boolean} [options.include[].required] If true, converts to an inner join, which means that the parent model will only be loaded if it has any matching children. True if `include.where` is set, false otherwise.
* @param {boolean} [options.include[].separate] If true, runs a separate query to fetch the associated instances, only supported for hasMany associations * @param {boolean} [options.include[].separate] If true, runs a separate query to fetch the associated instances, only supported for hasMany associations
* @param {number} [options.include[].limit] Limit the joined rows, only supported with include.separate=true * @param {number} [options.include[].limit] Limit the joined rows, only supported with include.separate=true
* @param {Object} [options.include[].through.where] Filter on the join model for belongsToMany relations * @param {object} [options.include[].through.where] Filter on the join model for belongsToMany relations
* @param {Array} [options.include[].through.attributes] A list of attributes to select from the join model for belongsToMany relations * @param {Array} [options.include[].through.attributes] A list of attributes to select from the join model for belongsToMany relations
* @param {Array<Object|Model|string>} [options.include[].include] Load further nested related models * @param {Array<object|Model|string>} [options.include[].include] Load further nested related models
* @param {boolean} [options.include[].duplicating] Mark the include as duplicating, will prevent a subquery from being used. * @param {boolean} [options.include[].duplicating] Mark the include as duplicating, will prevent a subquery from being used.
* @param {Array|Sequelize.fn|Sequelize.col|Sequelize.literal} [options.order] Specifies an ordering. Using an array, you can provide several columns / functions to order by. Each element can be further wrapped in a two-element array. The first element is the column / function to order by, the second is the direction. For example: `order: [['name', 'DESC']]`. In this way the column will be escaped, but the direction will not. * @param {Array|Sequelize.fn|Sequelize.col|Sequelize.literal} [options.order] Specifies an ordering. Using an array, you can provide several columns / functions to order by. Each element can be further wrapped in a two-element array. The first element is the column / function to order by, the second is the direction. For example: `order: [['name', 'DESC']]`. In this way the column will be escaped, but the direction will not.
* @param {number} [options.limit] Limit for result * @param {number} [options.limit] Limit for result
* @param {number} [options.offset] Offset for result * @param {number} [options.offset] Offset for result
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* @param {string|Object} [options.lock] Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model locks with joins. See [transaction.LOCK for an example](transaction#lock) * @param {string|object} [options.lock] Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model locks with joins. See [transaction.LOCK for an example](transaction#lock)
* @param {boolean} [options.raw] Return raw result. See sequelize.query for more information. * @param {boolean} [options.raw] Return raw result. See sequelize.query for more information.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging). * @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
* @param {Object} [options.having] Having options * @param {object} [options.having] Having options
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only) * @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* @param {boolean|Error} [options.rejectOnEmpty=false] Throws an error when no records found * @param {boolean|Error} [options.rejectOnEmpty=false] Throws an error when no records found
* *
...@@ -1852,7 +1852,7 @@ class Model { ...@@ -1852,7 +1852,7 @@ class Model {
* Search for a single instance by its primary key._ * Search for a single instance by its primary key._
* *
* @param {number|string|Buffer} param The value of the desired instance's primary key. * @param {number|string|Buffer} param The value of the desired instance's primary key.
* @param {Object} [options] find options * @param {object} [options] find options
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only) * @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* *
...@@ -1886,7 +1886,7 @@ class Model { ...@@ -1886,7 +1886,7 @@ class Model {
* *
* __Alias__: _find_ * __Alias__: _find_
* *
* @param {Object} [options] A hash of options to describe the scope of the search * @param {object} [options] A hash of options to describe the scope of the search
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only) * @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* *
...@@ -1925,8 +1925,8 @@ class Model { ...@@ -1925,8 +1925,8 @@ class Model {
* *
* @param {string} attribute The attribute to aggregate over. Can be a field name or * * @param {string} attribute The attribute to aggregate over. Can be a field name or *
* @param {string} aggregateFunction The function to use for aggregation, e.g. sum, max etc. * @param {string} aggregateFunction The function to use for aggregation, e.g. sum, max etc.
* @param {Object} [options] Query options. See sequelize.query for full options * @param {object} [options] Query options. See sequelize.query for full options
* @param {Object} [options.where] A hash of search attributes. * @param {object} [options.where] A hash of search attributes.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging). * @param {boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
* @param {DataTypes|string} [options.dataType] The type of the result. If `field` is a field in this Model, the default will be the type of that field, otherwise defaults to float. * @param {DataTypes|string} [options.dataType] The type of the result. If `field` is a field in this Model, the default will be the type of that field, otherwise defaults to float.
...@@ -1934,7 +1934,7 @@ class Model { ...@@ -1934,7 +1934,7 @@ class Model {
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* @param {boolean} [options.plain] When `true`, the first returned value of `aggregateFunction` is cast to `dataType` and returned. If additional attributes are specified, along with `group` clauses, set `plain` to `false` to return all values of all returned rows. Defaults to `true` * @param {boolean} [options.plain] When `true`, the first returned value of `aggregateFunction` is cast to `dataType` and returned. If additional attributes are specified, along with `group` clauses, set `plain` to `false` to return all values of all returned rows. Defaults to `true`
* *
* @returns {Promise<DataTypes|Object>} Returns the aggregate result cast to `options.dataType`, unless `options.plain` is false, in which case the complete data result is returned. * @returns {Promise<DataTypes|object>} Returns the aggregate result cast to `options.dataType`, unless `options.plain` is false, in which case the complete data result is returned.
*/ */
static aggregate(attribute, aggregateFunction, options) { static aggregate(attribute, aggregateFunction, options) {
options = Utils.cloneDeep(options); options = Utils.cloneDeep(options);
...@@ -1997,9 +1997,9 @@ class Model { ...@@ -1997,9 +1997,9 @@ class Model {
* *
* If you provide an `include` option, the number of matching associations will be counted instead. * If you provide an `include` option, the number of matching associations will be counted instead.
* *
* @param {Object} [options] options * @param {object} [options] options
* @param {Object} [options.where] A hash of search attributes. * @param {object} [options.where] A hash of search attributes.
* @param {Object} [options.include] Include options. See `find` for details * @param {object} [options.include] Include options. See `find` for details
* @param {boolean} [options.paranoid=true] Set `true` to count only non-deleted records. Can be used on models with `paranoid` enabled * @param {boolean} [options.paranoid=true] Set `true` to count only non-deleted records. Can be used on models with `paranoid` enabled
* @param {boolean} [options.distinct] Apply COUNT(DISTINCT(col)) on primary key or on options.col. * @param {boolean} [options.distinct] Apply COUNT(DISTINCT(col)) on primary key or on options.col.
* @param {string} [options.col] Column on which COUNT() should be applied * @param {string} [options.col] Column on which COUNT() should be applied
...@@ -2068,7 +2068,7 @@ class Model { ...@@ -2068,7 +2068,7 @@ class Model {
* *
* # Because the include for `Profile` has `required` set it will result in an inner join, and only the users who have a profile will be counted. If we remove `required` from the include, both users with and without profiles will be counted * # Because the include for `Profile` has `required` set it will result in an inner join, and only the users who have a profile will be counted. If we remove `required` from the include, both users with and without profiles will be counted
* *
* @param {Object} [options] See findAll options * @param {object} [options] See findAll options
* *
* @see * @see
* {@link Model.findAll} for a specification of find and query options * {@link Model.findAll} for a specification of find and query options
...@@ -2102,7 +2102,7 @@ class Model { ...@@ -2102,7 +2102,7 @@ class Model {
* Find the maximum value of field * Find the maximum value of field
* *
* @param {string} field attribute / field name * @param {string} field attribute / field name
* @param {Object} [options] See aggregate * @param {object} [options] See aggregate
* *
* @see * @see
* {@link Model.aggregate} for options * {@link Model.aggregate} for options
...@@ -2117,7 +2117,7 @@ class Model { ...@@ -2117,7 +2117,7 @@ class Model {
* Find the minimum value of field * Find the minimum value of field
* *
* @param {string} field attribute / field name * @param {string} field attribute / field name
* @param {Object} [options] See aggregate * @param {object} [options] See aggregate
* *
* @see * @see
* {@link Model.aggregate} for options * {@link Model.aggregate} for options
...@@ -2132,7 +2132,7 @@ class Model { ...@@ -2132,7 +2132,7 @@ class Model {
* Find the sum of field * Find the sum of field
* *
* @param {string} field attribute / field name * @param {string} field attribute / field name
* @param {Object} [options] See aggregate * @param {object} [options] See aggregate
* *
* @see * @see
* {@link Model.aggregate} for options * {@link Model.aggregate} for options
...@@ -2146,8 +2146,8 @@ class Model { ...@@ -2146,8 +2146,8 @@ class Model {
/** /**
* Builds multiple models in one operation. * Builds multiple models in one operation.
* *
* @param {Array<Object>} valueSets An object of key value pairs or an array of such. If an array, the function will return an array of instances. * @param {Array<object>} valueSets An object of key value pairs or an array of such. If an array, the function will return an array of instances.
* @param {Object} [options] Instance build options, * @param {object} [options] Instance build options,
* @see * @see
* {@link constructor} * {@link constructor}
* *
...@@ -2181,8 +2181,8 @@ class Model { ...@@ -2181,8 +2181,8 @@ class Model {
* @see * @see
* {@link Model.save} * {@link Model.save}
* *
* @param {Object} values hash of data values to create new record with * @param {object} values hash of data values to create new record with
* @param {Object} [options] build and query options * @param {object} [options] build and query options
* @param {boolean} [options.raw=false] If set to true, values will ignore field and virtual setters. * @param {boolean} [options.raw=false] If set to true, values will ignore field and virtual setters.
* @param {boolean} [options.isNewRecord=true] Is this new record * @param {boolean} [options.isNewRecord=true] Is this new record
* @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set` * @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set`
...@@ -2216,10 +2216,10 @@ class Model { ...@@ -2216,10 +2216,10 @@ class Model {
* Find a row that matches the query, or build (but don't save) the row if none is found. * Find a row that matches the query, or build (but don't save) the row if none is found.
* The successful result of the promise will be (instance, built) * The successful result of the promise will be (instance, built)
* *
* @param {Object} options find options * @param {object} options find options
* @param {Object} options.where A hash of search attributes. * @param {object} options.where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if building a new instance * @param {object} [options.defaults] Default values to use if building a new instance
* @param {Object} [options.transaction] Transaction to run query under * @param {object} [options.transaction] Transaction to run query under
* *
* @returns {Promise<Model,boolean>} * @returns {Promise<Model,boolean>}
*/ */
...@@ -2260,9 +2260,9 @@ class Model { ...@@ -2260,9 +2260,9 @@ class Model {
* @see * @see
* {@link Model.findAll} for a full specification of find and options * {@link Model.findAll} for a full specification of find and options
* *
* @param {Object} options find and create options * @param {object} options find and create options
* @param {Object} options.where where A hash of search attributes. * @param {object} options.where where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance * @param {object} [options.defaults] Default values to use if creating a new instance
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* *
* @returns {Promise<Model,boolean>} * @returns {Promise<Model,boolean>}
...@@ -2363,9 +2363,9 @@ class Model { ...@@ -2363,9 +2363,9 @@ class Model {
* @see * @see
* {@link Model.findAll} for a full specification of find and options * {@link Model.findAll} for a full specification of find and options
* *
* @param {Object} options find options * @param {object} options find options
* @param {Object} options.where A hash of search attributes. * @param {object} options.where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance * @param {object} [options.defaults] Default values to use if creating a new instance
* *
* @returns {Promise<Model,boolean>} * @returns {Promise<Model,boolean>}
*/ */
...@@ -2402,8 +2402,8 @@ class Model { ...@@ -2402,8 +2402,8 @@ class Model {
* * MSSQL - Implemented as a single query using `MERGE` and `WHEN (NOT) MATCHED THEN` * * MSSQL - Implemented as a single query using `MERGE` and `WHEN (NOT) MATCHED THEN`
* **Note** that SQLite returns undefined for created, no matter if the row was created or updated. This is because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know whether the row was inserted or not. * **Note** that SQLite returns undefined for created, no matter if the row was created or updated. This is because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know whether the row was inserted or not.
* *
* @param {Object} values hash of values to upsert * @param {object} values hash of values to upsert
* @param {Object} [options] upsert options * @param {object} [options] upsert options
* @param {boolean} [options.validate=true] Run validations before the row is inserted * @param {boolean} [options.validate=true] Run validations before the row is inserted
* @param {Array} [options.fields=Object.keys(this.attributes)] The fields to insert / update. Defaults to all changed fields * @param {Array} [options.fields=Object.keys(this.attributes)] The fields to insert / update. Defaults to all changed fields
* @param {boolean} [options.hooks=true] Run before / after upsert hooks? * @param {boolean} [options.hooks=true] Run before / after upsert hooks?
...@@ -2494,7 +2494,7 @@ class Model { ...@@ -2494,7 +2494,7 @@ class Model {
* If validation fails, the promise is rejected with an array-like [AggregateError](http://bluebirdjs.com/docs/api/aggregateerror.html) * If validation fails, the promise is rejected with an array-like [AggregateError](http://bluebirdjs.com/docs/api/aggregateerror.html)
* *
* @param {Array} records List of objects (key/value pairs) to create instances from * @param {Array} records List of objects (key/value pairs) to create instances from
* @param {Object} [options] Bulk create options * @param {object} [options] Bulk create options
* @param {Array} [options.fields] Fields to insert (defaults to all fields) * @param {Array} [options.fields] Fields to insert (defaults to all fields)
* @param {boolean} [options.validate=false] Should each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation * @param {boolean} [options.validate=false] Should each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation
* @param {boolean} [options.hooks=true] Run before / after bulk create hooks? * @param {boolean} [options.hooks=true] Run before / after bulk create hooks?
...@@ -2666,7 +2666,7 @@ class Model { ...@@ -2666,7 +2666,7 @@ class Model {
/** /**
* Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }). * Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }).
* *
* @param {Object} [options] The options passed to Model.destroy in addition to truncate * @param {object} [options] The options passed to Model.destroy in addition to truncate
* @param {boolean|Function} [options.cascade = false] Truncates all tables that have foreign-key references to the named table, or to any tables added to the group due to CASCADE. * @param {boolean|Function} [options.cascade = false] Truncates all tables that have foreign-key references to the named table, or to any tables added to the group due to CASCADE.
* @param {boolean} [options.restartIdentity=false] Automatically restart sequences owned by columns of the truncated table. * @param {boolean} [options.restartIdentity=false] Automatically restart sequences owned by columns of the truncated table.
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
...@@ -2688,8 +2688,8 @@ class Model { ...@@ -2688,8 +2688,8 @@ class Model {
/** /**
* Delete multiple instances, or set their deletedAt timestamp to the current time if `paranoid` is enabled. * Delete multiple instances, or set their deletedAt timestamp to the current time if `paranoid` is enabled.
* *
* @param {Object} options destroy options * @param {object} options destroy options
* @param {Object} [options.where] Filter the destroy * @param {object} [options.where] Filter the destroy
* @param {boolean} [options.hooks=true] Run before / after bulk destroy hooks? * @param {boolean} [options.hooks=true] Run before / after bulk destroy hooks?
* @param {boolean} [options.individualHooks=false] If set to true, destroy will SELECT all records matching the where parameter and will execute before / after destroy hooks on each row * @param {boolean} [options.individualHooks=false] If set to true, destroy will SELECT all records matching the where parameter and will execute before / after destroy hooks on each row
* @param {number} [options.limit] How many rows to delete * @param {number} [options.limit] How many rows to delete
...@@ -2779,8 +2779,8 @@ class Model { ...@@ -2779,8 +2779,8 @@ class Model {
/** /**
* Restore multiple instances if `paranoid` is enabled. * Restore multiple instances if `paranoid` is enabled.
* *
* @param {Object} options restore options * @param {object} options restore options
* @param {Object} [options.where] Filter the restore * @param {object} [options.where] Filter the restore
* @param {boolean} [options.hooks=true] Run before / after bulk restore hooks? * @param {boolean} [options.hooks=true] Run before / after bulk restore hooks?
* @param {boolean} [options.individualHooks=false] If set to true, restore will find all records within the where parameter and will execute before / after bulkRestore hooks on each row * @param {boolean} [options.individualHooks=false] If set to true, restore will find all records within the where parameter and will execute before / after bulkRestore hooks on each row
* @param {number} [options.limit] How many rows to undelete (only for mysql) * @param {number} [options.limit] How many rows to undelete (only for mysql)
...@@ -2845,9 +2845,9 @@ class Model { ...@@ -2845,9 +2845,9 @@ class Model {
/** /**
* Update multiple instances that match the where options. * Update multiple instances that match the where options.
* *
* @param {Object} values hash of values to update * @param {object} values hash of values to update
* @param {Object} options update options * @param {object} options update options
* @param {Object} options.where Options to describe the scope of the search. * @param {object} options.where Options to describe the scope of the search.
* @param {boolean} [options.paranoid=true] If true, only non-deleted records will be updated. If false, both deleted and non-deleted records will be updated. Only applies if `options.paranoid` is true for the model. * @param {boolean} [options.paranoid=true] If true, only non-deleted records will be updated. If false, both deleted and non-deleted records will be updated. Only applies if `options.paranoid` is true for the model.
* @param {Array} [options.fields] Fields to update (defaults to all fields) * @param {Array} [options.fields] Fields to update (defaults to all fields)
* @param {boolean} [options.validate=true] Should each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation * @param {boolean} [options.validate=true] Should each row be subject to validation before it is inserted. The whole insert will fail if one row fails validation
...@@ -3070,7 +3070,7 @@ class Model { ...@@ -3070,7 +3070,7 @@ class Model {
* Run a describe query on the table. * Run a describe query on the table.
* *
* @param {string} [schema] schema name to search table in * @param {string} [schema] schema name to search table in
* @param {Object} [options] query options * @param {object} [options] query options
* *
* @returns {Promise} hash of attributes and their types * @returns {Promise} hash of attributes and their types
*/ */
...@@ -3137,9 +3137,9 @@ class Model { ...@@ -3137,9 +3137,9 @@ class Model {
* @see * @see
* {@link Model#reload} * {@link Model#reload}
* *
* @param {string|Array|Object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given. * @param {string|Array|object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given.
* @param {Object} options increment options * @param {object} options increment options
* @param {Object} options.where conditions hash * @param {object} options.where conditions hash
* @param {number} [options.by=1] The number to increment by * @param {number} [options.by=1] The number to increment by
* @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated. * @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
...@@ -3222,8 +3222,8 @@ class Model { ...@@ -3222,8 +3222,8 @@ class Model {
* // `by` is ignored, since each column has its own value * // `by` is ignored, since each column has its own value
* Model.decrement({ answer: 42, tries: -1}, { by: 2, where: { foo: 'bar' } }); * Model.decrement({ answer: 42, tries: -1}, { by: 2, where: { foo: 'bar' } });
* *
* @param {string|Array|Object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given. * @param {string|Array|object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given.
* @param {Object} options decrement options, similar to increment * @param {object} options decrement options, similar to increment
* *
* @see * @see
* {@link Model.increment} * {@link Model.increment}
...@@ -3254,7 +3254,7 @@ class Model { ...@@ -3254,7 +3254,7 @@ class Model {
* *
* @param {boolean} [checkVersion=false] include version attribute in where hash * @param {boolean} [checkVersion=false] include version attribute in where hash
* *
* @returns {Object} * @returns {object}
*/ */
where(checkVersion) { where(checkVersion) {
const where = this.constructor.primaryKeyAttributes.reduce((result, attribute) => { const where = this.constructor.primaryKeyAttributes.reduce((result, attribute) => {
...@@ -3310,11 +3310,11 @@ class Model { ...@@ -3310,11 +3310,11 @@ class Model {
* If key is given and a field or virtual getter is present for the key it will call that getter - else it will return the value for key. * If key is given and a field or virtual getter is present for the key it will call that getter - else it will return the value for key.
* *
* @param {string} [key] key to get value of * @param {string} [key] key to get value of
* @param {Object} [options] get options * @param {object} [options] get options
* @param {boolean} [options.plain=false] If set to true, included instances will be returned as plain objects * @param {boolean} [options.plain=false] If set to true, included instances will be returned as plain objects
* @param {boolean} [options.raw=false] If set to true, field and virtual setters will be ignored * @param {boolean} [options.raw=false] If set to true, field and virtual setters will be ignored
* *
* @returns {Object|any} * @returns {object|any}
*/ */
get(key, options) { get(key, options) {
if (options === undefined && typeof key === 'object') { if (options === undefined && typeof key === 'object') {
...@@ -3396,9 +3396,9 @@ class Model { ...@@ -3396,9 +3396,9 @@ class Model {
* @see * @see
* {@link Model.findAll} for more information about includes * {@link Model.findAll} for more information about includes
* *
* @param {string|Object} key key to set, it can be string or object. When string it will set that key, for object it will loop over all object properties nd set them. * @param {string|object} key key to set, it can be string or object. When string it will set that key, for object it will loop over all object properties nd set them.
* @param {any} value value to set * @param {any} value value to set
* @param {Object} [options] set options * @param {object} [options] set options
* @param {boolean} [options.raw=false] If set to true, field and virtual setters will be ignored * @param {boolean} [options.raw=false] If set to true, field and virtual setters will be ignored
* @param {boolean} [options.reset=false] Clear all previously set data values * @param {boolean} [options.reset=false] Clear all previously set data values
* *
...@@ -3625,7 +3625,7 @@ class Model { ...@@ -3625,7 +3625,7 @@ class Model {
* On success, the callback will be called with this instance. On validation error, the callback will be called with an instance of `Sequelize.ValidationError`. * On success, the callback will be called with this instance. On validation error, the callback will be called with an instance of `Sequelize.ValidationError`.
* This error will have a property for each of the fields for which validation failed, with the error message for that field. * This error will have a property for each of the fields for which validation failed, with the error message for that field.
* *
* @param {Object} [options] save options * @param {object} [options] save options
* @param {string[]} [options.fields] An optional array of strings, representing database columns. If fields is provided, only those columns will be validated and saved. * @param {string[]} [options.fields] An optional array of strings, representing database columns. If fields is provided, only those columns will be validated and saved.
* @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated. * @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated.
* @param {boolean} [options.validate=true] If false, validations won't be run. * @param {boolean} [options.validate=true] If false, validations won't be run.
...@@ -3906,7 +3906,7 @@ class Model { ...@@ -3906,7 +3906,7 @@ class Model {
* @see * @see
* {@link Model.findAll} * {@link Model.findAll}
* *
* @param {Object} [options] Options that are passed on to `Model.find` * @param {object} [options] Options that are passed on to `Model.find`
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* *
* @returns {Promise<Model>} * @returns {Promise<Model>}
...@@ -3942,7 +3942,7 @@ class Model { ...@@ -3942,7 +3942,7 @@ class Model {
* *
* The promise fulfills if and only if validation successful; otherwise it rejects an Error instance containing { field name : [error msgs] } entries. * The promise fulfills if and only if validation successful; otherwise it rejects an Error instance containing { field name : [error msgs] } entries.
* *
* @param {Object} [options] Options that are passed to the validator * @param {object} [options] Options that are passed to the validator
* @param {Array} [options.skip] An array of strings. All properties that are in this array will not be validated * @param {Array} [options.skip] An array of strings. All properties that are in this array will not be validated
* @param {Array} [options.fields] An array of strings. Only the properties that are in this array will be validated * @param {Array} [options.fields] An array of strings. Only the properties that are in this array will be validated
* @param {boolean} [options.hooks=true] Run before and after validate hooks * @param {boolean} [options.hooks=true] Run before and after validate hooks
...@@ -3962,8 +3962,8 @@ class Model { ...@@ -3962,8 +3962,8 @@ class Model {
* @see * @see
* {@link Model#save} * {@link Model#save}
* *
* @param {Object} values See `set` * @param {object} values See `set`
* @param {Object} options See `save` * @param {object} options See `save`
* *
* @returns {Promise<Model>} * @returns {Promise<Model>}
*/ */
...@@ -3995,7 +3995,7 @@ class Model { ...@@ -3995,7 +3995,7 @@ class Model {
/** /**
* Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will either be completely deleted, or have its deletedAt timestamp set to the current time. * Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will either be completely deleted, or have its deletedAt timestamp set to the current time.
* *
* @param {Object} [options={}] destroy options * @param {object} [options={}] destroy options
* @param {boolean} [options.force=false] If set to true, paranoid models will actually be deleted * @param {boolean} [options.force=false] If set to true, paranoid models will actually be deleted
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
...@@ -4072,7 +4072,7 @@ class Model { ...@@ -4072,7 +4072,7 @@ class Model {
/** /**
* Restore the row corresponding to this instance. Only available for paranoid models. * Restore the row corresponding to this instance. Only available for paranoid models.
* *
* @param {Object} [options={}] restore options * @param {object} [options={}] restore options
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Transaction} [options.transaction] Transaction to run query under * @param {Transaction} [options.transaction] Transaction to run query under
* *
...@@ -4125,8 +4125,8 @@ class Model { ...@@ -4125,8 +4125,8 @@ class Model {
* @see * @see
* {@link Model#reload} * {@link Model#reload}
* *
* @param {string|Array|Object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given. * @param {string|Array|object} fields If a string is provided, that column is incremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is incremented by the value given.
* @param {Object} [options] options * @param {object} [options] options
* @param {number} [options.by=1] The number to increment by * @param {number} [options.by=1] The number to increment by
* @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated. * @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
...@@ -4165,8 +4165,8 @@ class Model { ...@@ -4165,8 +4165,8 @@ class Model {
* *
* @see * @see
* {@link Model#reload} * {@link Model#reload}
* @param {string|Array|Object} fields If a string is provided, that column is decremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is decremented by the value given * @param {string|Array|object} fields If a string is provided, that column is decremented by the value of `by` given in options. If an array is provided, the same is true for each column. If and object is provided, each column is decremented by the value given
* @param {Object} [options] decrement options * @param {object} [options] decrement options
* @param {number} [options.by=1] The number to decrement by * @param {number} [options.by=1] The number to decrement by
* @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated. * @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
...@@ -4228,7 +4228,7 @@ class Model { ...@@ -4228,7 +4228,7 @@ class Model {
* @see * @see
* {@link Model#get} * {@link Model#get}
* *
* @returns {Object} * @returns {object}
*/ */
toJSON() { toJSON() {
return _.cloneDeep( return _.cloneDeep(
...@@ -4243,12 +4243,12 @@ class Model { ...@@ -4243,12 +4243,12 @@ class Model {
* The foreign key is added on the target. * The foreign key is added on the target.
* *
* @param {Model} target Target model * @param {Model} target Target model
* @param {Object} [options] hasMany association options * @param {object} [options] hasMany association options
* @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks * @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks
* @param {string|Object} [options.as] The alias of this model. If you provide a string, it should be plural, and will be singularized using node.inflection. If you want to control the singular version yourself, provide an object with `plural` and `singular` keys. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the pluralized name of target * @param {string|object} [options.as] The alias of this model. If you provide a string, it should be plural, and will be singularized using node.inflection. If you want to control the singular version yourself, provide an object with `plural` and `singular` keys. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the pluralized name of target
* @param {string|Object} [options.foreignKey] The name of the foreign key in the target table or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source * @param {string|object} [options.foreignKey] The name of the foreign key in the target table or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source
* @param {string} [options.sourceKey] The name of the field to use as the key for the association in the source table. Defaults to the primary key of the source table * @param {string} [options.sourceKey] The name of the field to use as the key for the association in the source table. Defaults to the primary key of the source table
* @param {Object} [options.scope] A key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M) * @param {object} [options.scope] A key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M)
* @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] SET NULL if foreignKey allows nulls, CASCADE if otherwise * @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] SET NULL if foreignKey allows nulls, CASCADE if otherwise
* @param {string} [options.onUpdate='CASCADE'] Set `ON UPDATE` * @param {string} [options.onUpdate='CASCADE'] Set `ON UPDATE`
* @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key. * @param {boolean} [options.constraints=true] Should on update and on delete constraints be enabled on the foreign key.
...@@ -4264,16 +4264,16 @@ class Model { ...@@ -4264,16 +4264,16 @@ class Model {
* Create an N:M association with a join table. Defining `through` is required. * Create an N:M association with a join table. Defining `through` is required.
* *
* @param {Model} target Target model * @param {Model} target Target model
* @param {Object} options belongsToMany association options * @param {object} options belongsToMany association options
* @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks * @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks
* @param {Model|string|Object} options.through The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it. * @param {Model|string|object} options.through The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it.
* @param {Model} [options.through.model] The model used to join both sides of the N:M association. * @param {Model} [options.through.model] The model used to join both sides of the N:M association.
* @param {Object} [options.through.scope] A key/value set that will be used for association create and find defaults on the through model. (Remember to add the attributes to the through model) * @param {object} [options.through.scope] A key/value set that will be used for association create and find defaults on the through model. (Remember to add the attributes to the through model)
* @param {boolean} [options.through.unique=true] If true a unique key will be generated from the foreign keys used (might want to turn this off and create specific unique keys when using scopes) * @param {boolean} [options.through.unique=true] If true a unique key will be generated from the foreign keys used (might want to turn this off and create specific unique keys when using scopes)
* @param {string|Object} [options.as] The alias of this association. If you provide a string, it should be plural, and will be singularized using node.inflection. If you want to control the singular version yourself, provide an object with `plural` and `singular` keys. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the pluralized name of target * @param {string|object} [options.as] The alias of this association. If you provide a string, it should be plural, and will be singularized using node.inflection. If you want to control the singular version yourself, provide an object with `plural` and `singular` keys. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the pluralized name of target
* @param {string|Object} [options.foreignKey] The name of the foreign key in the join table (representing the source model) or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source * @param {string|object} [options.foreignKey] The name of the foreign key in the join table (representing the source model) or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source
* @param {string|Object} [options.otherKey] The name of the foreign key in the join table (representing the target model) or an object representing the type definition for the other column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of target + primary key of target * @param {string|object} [options.otherKey] The name of the foreign key in the join table (representing the target model) or an object representing the type definition for the other column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of target + primary key of target
* @param {Object} [options.scope] A key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M) * @param {object} [options.scope] A key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M)
* @param {boolean} [options.timestamps=sequelize.options.timestamps] Should the join model have timestamps * @param {boolean} [options.timestamps=sequelize.options.timestamps] Should the join model have timestamps
* @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] Cascade if this is a n:m, and set null if it is a 1:m * @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] Cascade if this is a n:m, and set null if it is a 1:m
* @param {string} [options.onUpdate='CASCADE'] Sets `ON UPDATE` * @param {string} [options.onUpdate='CASCADE'] Sets `ON UPDATE`
...@@ -4299,10 +4299,10 @@ class Model { ...@@ -4299,10 +4299,10 @@ class Model {
* Creates an association between this (the source) and the provided target. The foreign key is added on the target. * Creates an association between this (the source) and the provided target. The foreign key is added on the target.
* *
* @param {Model} target Target model * @param {Model} target Target model
* @param {Object} [options] hasOne association options * @param {object} [options] hasOne association options
* @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks * @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks
* @param {string} [options.as] The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the singularized name of target * @param {string} [options.as] The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the singularized name of target
* @param {string|Object} [options.foreignKey] The name of the foreign key attribute in the target model or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source * @param {string|object} [options.foreignKey] The name of the foreign key attribute in the target model or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of source + primary key of source
* @param {string} [options.sourceKey] The name of the attribute to use as the key for the association in the source table. Defaults to the primary key of the source table * @param {string} [options.sourceKey] The name of the attribute to use as the key for the association in the source table. Defaults to the primary key of the source table
* @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] SET NULL if foreignKey allows nulls, CASCADE if otherwise * @param {string} [options.onDelete='SET&nbsp;NULL|CASCADE'] SET NULL if foreignKey allows nulls, CASCADE if otherwise
* @param {string} [options.onUpdate='CASCADE'] Sets 'ON UPDATE' * @param {string} [options.onUpdate='CASCADE'] Sets 'ON UPDATE'
...@@ -4320,10 +4320,10 @@ class Model { ...@@ -4320,10 +4320,10 @@ class Model {
* Creates an association between this (the source) and the provided target. The foreign key is added on the source. * Creates an association between this (the source) and the provided target. The foreign key is added on the source.
* *
* @param {Model} target The target model * @param {Model} target The target model
* @param {Object} [options] belongsTo association options * @param {object} [options] belongsTo association options
* @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks * @param {boolean} [options.hooks=false] Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade. For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking any hooks
* @param {string} [options.as] The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the singularized name of target * @param {string} [options.as] The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If you create multiple associations between the same tables, you should provide an alias to be able to distinguish between them. If you provide an alias when creating the association, you should provide the same alias when eager loading and when getting associated models. Defaults to the singularized name of target
* @param {string|Object} [options.foreignKey] The name of the foreign key attribute in the source table or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of target + primary key of target * @param {string|object} [options.foreignKey] The name of the foreign key attribute in the source table or an object representing the type definition for the foreign column (see `Sequelize.define` for syntax). When using an object, you can add a `name` property to set the name of the column. Defaults to the name of target + primary key of target
* @param {string} [options.targetKey] The name of the attribute to use as the key for the association in the target table. Defaults to the primary key of the target table * @param {string} [options.targetKey] The name of the attribute to use as the key for the association in the target table. Defaults to the primary key of the target table
* @param {string} [options.onDelete='SET&nbsp;NULL|NO&nbsp;ACTION'] SET NULL if foreignKey allows nulls, NO ACTION if otherwise * @param {string} [options.onDelete='SET&nbsp;NULL|NO&nbsp;ACTION'] SET NULL if foreignKey allows nulls, NO ACTION if otherwise
* @param {string} [options.onUpdate='CASCADE'] Sets 'ON UPDATE' * @param {string} [options.onUpdate='CASCADE'] Sets 'ON UPDATE'
......
...@@ -28,7 +28,7 @@ class QueryInterface { ...@@ -28,7 +28,7 @@ class QueryInterface {
* Create a database * Create a database
* *
* @param {string} database Database name to create * @param {string} database Database name to create
* @param {Object} [options] Query options * @param {object} [options] Query options
* @param {string} [options.charset] Database default character set, MYSQL only * @param {string} [options.charset] Database default character set, MYSQL only
* @param {string} [options.collate] Database default collation * @param {string} [options.collate] Database default collation
* @param {string} [options.encoding] Database default character set, PostgreSQL only * @param {string} [options.encoding] Database default character set, PostgreSQL only
...@@ -46,7 +46,7 @@ class QueryInterface { ...@@ -46,7 +46,7 @@ class QueryInterface {
* Drop a database * Drop a database
* *
* @param {string} database Database name to drop * @param {string} database Database name to drop
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -59,7 +59,7 @@ class QueryInterface { ...@@ -59,7 +59,7 @@ class QueryInterface {
* Create a schema * Create a schema
* *
* @param {string} schema Schema name to create * @param {string} schema Schema name to create
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -72,7 +72,7 @@ class QueryInterface { ...@@ -72,7 +72,7 @@ class QueryInterface {
* Drop a schema * Drop a schema
* *
* @param {string} schema Schema name to drop * @param {string} schema Schema name to drop
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -84,7 +84,7 @@ class QueryInterface { ...@@ -84,7 +84,7 @@ class QueryInterface {
/** /**
* Drop all schemas * Drop all schemas
* *
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -98,7 +98,7 @@ class QueryInterface { ...@@ -98,7 +98,7 @@ class QueryInterface {
/** /**
* Show all schemas * Show all schemas
* *
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise<Array>} * @returns {Promise<Array>}
*/ */
...@@ -118,7 +118,7 @@ class QueryInterface { ...@@ -118,7 +118,7 @@ class QueryInterface {
/** /**
* Return database version * Return database version
* *
* @param {Object} [options] Query options * @param {object} [options] Query options
* @param {QueryType} [options.type] Query type * @param {QueryType} [options.type] Query type
* *
* @returns {Promise} * @returns {Promise}
...@@ -178,8 +178,8 @@ class QueryInterface { ...@@ -178,8 +178,8 @@ class QueryInterface {
* ``` * ```
* *
* @param {string} tableName Name of table to create * @param {string} tableName Name of table to create
* @param {Object} attributes Object representing a list of table attributes to create * @param {object} attributes Object representing a list of table attributes to create
* @param {Object} [options] create table and query options * @param {object} [options] create table and query options
* @param {Model} [model] model class * @param {Model} [model] model class
* *
* @returns {Promise} * @returns {Promise}
...@@ -234,7 +234,7 @@ class QueryInterface { ...@@ -234,7 +234,7 @@ class QueryInterface {
* Drop a table from database * Drop a table from database
* *
* @param {string} tableName Table name to drop * @param {string} tableName Table name to drop
* @param {Object} options Query options * @param {object} options Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -276,7 +276,7 @@ class QueryInterface { ...@@ -276,7 +276,7 @@ class QueryInterface {
/** /**
* Drop all tables from database * Drop all tables from database
* *
* @param {Object} [options] query options * @param {object} [options] query options
* @param {Array} [options.skip] List of table to skip * @param {Array} [options.skip] List of table to skip
* *
* @returns {Promise} * @returns {Promise}
...@@ -328,7 +328,7 @@ class QueryInterface { ...@@ -328,7 +328,7 @@ class QueryInterface {
* Drop specified enum from database (Postgres only) * Drop specified enum from database (Postgres only)
* *
* @param {string} [enumName] Enum name to drop * @param {string} [enumName] Enum name to drop
* @param {Object} options Query options * @param {object} options Query options
* *
* @returns {Promise} * @returns {Promise}
* @private * @private
...@@ -347,7 +347,7 @@ class QueryInterface { ...@@ -347,7 +347,7 @@ class QueryInterface {
/** /**
* Drop all enums from database (Postgres only) * Drop all enums from database (Postgres only)
* *
* @param {Object} options Query options * @param {object} options Query options
* *
* @returns {Promise} * @returns {Promise}
* @private * @private
...@@ -367,7 +367,7 @@ class QueryInterface { ...@@ -367,7 +367,7 @@ class QueryInterface {
* List all enums (Postgres only) * List all enums (Postgres only)
* *
* @param {string} [tableName] Table whose enum to list * @param {string} [tableName] Table whose enum to list
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
* @private * @private
...@@ -382,7 +382,7 @@ class QueryInterface { ...@@ -382,7 +382,7 @@ class QueryInterface {
* *
* @param {string} before Current name of table * @param {string} before Current name of table
* @param {string} after New name from table * @param {string} after New name from table
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -394,7 +394,7 @@ class QueryInterface { ...@@ -394,7 +394,7 @@ class QueryInterface {
/** /**
* Get all tables in current database * Get all tables in current database
* *
* @param {Object} [options] Query options * @param {object} [options] Query options
* @param {boolean} [options.raw=true] Run query in raw mode * @param {boolean} [options.raw=true] Run query in raw mode
* @param {QueryType} [options.type=QueryType.SHOWTABLE] query type * @param {QueryType} [options.type=QueryType.SHOWTABLE] query type
* *
...@@ -432,9 +432,9 @@ class QueryInterface { ...@@ -432,9 +432,9 @@ class QueryInterface {
* ``` * ```
* *
* @param {string} tableName table name * @param {string} tableName table name
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise<Object>} * @returns {Promise<object>}
*/ */
describeTable(tableName, options) { describeTable(tableName, options) {
let schema = null; let schema = null;
...@@ -486,8 +486,8 @@ class QueryInterface { ...@@ -486,8 +486,8 @@ class QueryInterface {
* *
* @param {string} table Table to add column to * @param {string} table Table to add column to
* @param {string} key Column name * @param {string} key Column name
* @param {Object} attribute Attribute definition * @param {object} attribute Attribute definition
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -505,7 +505,7 @@ class QueryInterface { ...@@ -505,7 +505,7 @@ class QueryInterface {
* *
* @param {string} tableName Table to remove column from * @param {string} tableName Table to remove column from
* @param {string} attributeName Columns name to remove * @param {string} attributeName Columns name to remove
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -531,8 +531,8 @@ class QueryInterface { ...@@ -531,8 +531,8 @@ class QueryInterface {
* *
* @param {string} tableName Table name to change from * @param {string} tableName Table name to change from
* @param {string} attributeName Column name * @param {string} attributeName Column name
* @param {Object} dataTypeOrOptions Attribute definition for new column * @param {object} dataTypeOrOptions Attribute definition for new column
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -566,7 +566,7 @@ class QueryInterface { ...@@ -566,7 +566,7 @@ class QueryInterface {
* @param {string} tableName Table name whose column to rename * @param {string} tableName Table name whose column to rename
* @param {string} attrNameBefore Current column name * @param {string} attrNameBefore Current column name
* @param {string} attrNameAfter New column name * @param {string} attrNameAfter New column name
* @param {Object} [options] Query option * @param {object} [options] Query option
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -608,9 +608,9 @@ class QueryInterface { ...@@ -608,9 +608,9 @@ class QueryInterface {
/** /**
* Add an index to a column * Add an index to a column
* *
* @param {string|Object} tableName Table name to add index on, can be a object with schema * @param {string|object} tableName Table name to add index on, can be a object with schema
* @param {Array} [attributes] Use options.fields instead, List of attributes to add index on * @param {Array} [attributes] Use options.fields instead, List of attributes to add index on
* @param {Object} options indexes options * @param {object} options indexes options
* @param {Array} options.fields List of attributes to add index on * @param {Array} options.fields List of attributes to add index on
* @param {boolean} [options.concurrently] Pass CONCURRENT so other operations run while the index is created * @param {boolean} [options.concurrently] Pass CONCURRENT so other operations run while the index is created
* @param {boolean} [options.unique] Create a unique index * @param {boolean} [options.unique] Create a unique index
...@@ -618,7 +618,7 @@ class QueryInterface { ...@@ -618,7 +618,7 @@ class QueryInterface {
* @param {string} [options.operator] Index operator * @param {string} [options.operator] Index operator
* @param {string} [options.type] Type of index, available options are UNIQUE|FULLTEXT|SPATIAL * @param {string} [options.type] Type of index, available options are UNIQUE|FULLTEXT|SPATIAL
* @param {string} [options.name] Name of the index. Default is <table>_<attr1>_<attr2> * @param {string} [options.name] Name of the index. Default is <table>_<attr1>_<attr2>
* @param {Object} [options.where] Where condition on index, for partial indexes * @param {object} [options.where] Where condition on index, for partial indexes
* @param {string} [rawTablename] table name, this is just for backward compatibiity * @param {string} [rawTablename] table name, this is just for backward compatibiity
* *
* @returns {Promise} * @returns {Promise}
...@@ -646,7 +646,7 @@ class QueryInterface { ...@@ -646,7 +646,7 @@ class QueryInterface {
* Show indexes on a table * Show indexes on a table
* *
* @param {string} tableName table name * @param {string} tableName table name
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise<Array>} * @returns {Promise<Array>}
* @private * @private
...@@ -693,7 +693,7 @@ class QueryInterface { ...@@ -693,7 +693,7 @@ class QueryInterface {
* Remind: constraint informations won't return if it's sqlite. * Remind: constraint informations won't return if it's sqlite.
* *
* @param {string} tableName table name * @param {string} tableName table name
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -729,7 +729,7 @@ class QueryInterface { ...@@ -729,7 +729,7 @@ class QueryInterface {
* *
* @param {string} tableName Table name to drop index from * @param {string} tableName Table name to drop index from
* @param {string} indexNameOrAttributes Index name * @param {string} indexNameOrAttributes Index name
* @param {Object} [options] Query options * @param {object} [options] Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -788,12 +788,12 @@ class QueryInterface { ...@@ -788,12 +788,12 @@ class QueryInterface {
* *
* @param {string} tableName Table name where you want to add a constraint * @param {string} tableName Table name where you want to add a constraint
* @param {Array} attributes Array of column names to apply the constraint over * @param {Array} attributes Array of column names to apply the constraint over
* @param {Object} options An object to define the constraint name, type etc * @param {object} options An object to define the constraint name, type etc
* @param {string} options.type Type of constraint. One of the values in available constraints(case insensitive) * @param {string} options.type Type of constraint. One of the values in available constraints(case insensitive)
* @param {string} [options.name] Name of the constraint. If not specified, sequelize automatically creates a named constraint based on constraint type, table & column names * @param {string} [options.name] Name of the constraint. If not specified, sequelize automatically creates a named constraint based on constraint type, table & column names
* @param {string} [options.defaultValue] The value for the default constraint * @param {string} [options.defaultValue] The value for the default constraint
* @param {Object} [options.where] Where clause/expression for the CHECK constraint * @param {object} [options.where] Where clause/expression for the CHECK constraint
* @param {Object} [options.references] Object specifying target table, column name to create foreign key constraint * @param {object} [options.references] Object specifying target table, column name to create foreign key constraint
* @param {string} [options.references.table] Target table name * @param {string} [options.references.table] Target table name
* @param {string} [options.references.field] Target column name * @param {string} [options.references.field] Target column name
* @param {string} [rawTablename] Table name, for backward compatibility * @param {string} [rawTablename] Table name, for backward compatibility
...@@ -836,7 +836,7 @@ class QueryInterface { ...@@ -836,7 +836,7 @@ class QueryInterface {
* *
* @param {string} tableName Table name to drop constraint from * @param {string} tableName Table name to drop constraint from
* @param {string} constraintName Constraint name * @param {string} constraintName Constraint name
* @param {Object} options Query options * @param {object} options Query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -873,11 +873,11 @@ class QueryInterface { ...@@ -873,11 +873,11 @@ class QueryInterface {
* Upsert * Upsert
* *
* @param {string} tableName table to upsert on * @param {string} tableName table to upsert on
* @param {Object} insertValues values to be inserted, mapped to field name * @param {object} insertValues values to be inserted, mapped to field name
* @param {Object} updateValues values to be updated, mapped to field name * @param {object} updateValues values to be updated, mapped to field name
* @param {Object} where various conditions * @param {object} where various conditions
* @param {Model} model Model to upsert on * @param {Model} model Model to upsert on
* @param {Object} options query options * @param {object} options query options
* *
* @returns {Promise<boolean,?number>} Resolves an array with <created, primaryKey> * @returns {Promise<boolean,?number>} Resolves an array with <created, primaryKey>
*/ */
...@@ -966,8 +966,8 @@ class QueryInterface { ...@@ -966,8 +966,8 @@ class QueryInterface {
* *
* @param {string} tableName Table name to insert record to * @param {string} tableName Table name to insert record to
* @param {Array} records List of records to insert * @param {Array} records List of records to insert
* @param {Object} options Various options, please see Model.bulkCreate options * @param {object} options Various options, please see Model.bulkCreate options
* @param {Object} attributes Various attributes mapped by field name * @param {object} attributes Various attributes mapped by field name
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -1005,10 +1005,10 @@ class QueryInterface { ...@@ -1005,10 +1005,10 @@ class QueryInterface {
* ); * );
* *
* @param {string} tableName Table name to update * @param {string} tableName Table name to update
* @param {Object} values Values to be inserted, mapped to field name * @param {object} values Values to be inserted, mapped to field name
* @param {Object} identifier A hash with conditions OR an ID as integer OR a string with conditions * @param {object} identifier A hash with conditions OR an ID as integer OR a string with conditions
* @param {Object} [options] Various options, please see Model.bulkCreate options * @param {object} [options] Various options, please see Model.bulkCreate options
* @param {Object} [attributes] Attributes on return objects if supported by SQL dialect * @param {object} [attributes] Attributes on return objects if supported by SQL dialect
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -1067,8 +1067,8 @@ class QueryInterface { ...@@ -1067,8 +1067,8 @@ class QueryInterface {
* Delete multiple records from a table * Delete multiple records from a table
* *
* @param {string} tableName table name from where to delete records * @param {string} tableName table name from where to delete records
* @param {Object} where where conditions to find records to delete * @param {object} where where conditions to find records to delete
* @param {Object} [options] options * @param {object} [options] options
* @param {boolean} [options.truncate] Use truncate table command * @param {boolean} [options.truncate] Use truncate table command
* @param {Model} [model] Model * @param {Model} [model] Model
* *
...@@ -1222,7 +1222,7 @@ class QueryInterface { ...@@ -1222,7 +1222,7 @@ class QueryInterface {
* @param {string} language The name of the language that the function is implemented in * @param {string} language The name of the language that the function is implemented in
* @param {string} body Source code of function * @param {string} body Source code of function
* @param {Array} optionsArray Extra-options for creation * @param {Array} optionsArray Extra-options for creation
* @param {Object} [options] query options * @param {object} [options] query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -1249,7 +1249,7 @@ class QueryInterface { ...@@ -1249,7 +1249,7 @@ class QueryInterface {
* *
* @param {string} functionName Name of SQL function to drop * @param {string} functionName Name of SQL function to drop
* @param {Array} params List of parameters declared for SQL function * @param {Array} params List of parameters declared for SQL function
* @param {Object} [options] query options * @param {object} [options] query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -1278,7 +1278,7 @@ class QueryInterface { ...@@ -1278,7 +1278,7 @@ class QueryInterface {
* @param {string} oldFunctionName Current name of function * @param {string} oldFunctionName Current name of function
* @param {Array} params List of parameters declared for SQL function * @param {Array} params List of parameters declared for SQL function
* @param {string} newFunctionName New name of function * @param {string} newFunctionName New name of function
* @param {Object} [options] query options * @param {object} [options] query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
......
...@@ -52,23 +52,23 @@ class Sequelize { ...@@ -52,23 +52,23 @@ class Sequelize {
* // the sql dialect of the database * // the sql dialect of the database
* // currently supported: 'mysql', 'sqlite', 'postgres', 'mssql' * // currently supported: 'mysql', 'sqlite', 'postgres', 'mssql'
* dialect: 'mysql', * dialect: 'mysql',
* *
* // custom host; default: localhost * // custom host; default: localhost
* host: 'my.server.tld', * host: 'my.server.tld',
* // for postgres, you can also specify an absolute path to a directory * // for postgres, you can also specify an absolute path to a directory
* // containing a UNIX socket to connect over * // containing a UNIX socket to connect over
* // host: '/sockets/psql_sockets'. * // host: '/sockets/psql_sockets'.
* *
* // custom port; default: dialect default * // custom port; default: dialect default
* port: 12345, * port: 12345,
* *
* // custom protocol; default: 'tcp' * // custom protocol; default: 'tcp'
* // postgres only, useful for Heroku * // postgres only, useful for Heroku
* protocol: null, * protocol: null,
* *
* // disable logging or provide a custom logging function; default: console.log * // disable logging or provide a custom logging function; default: console.log
* logging: false, * logging: false,
* *
* // you can also pass any dialect options to the underlying dialect library * // you can also pass any dialect options to the underlying dialect library
* // - default is empty * // - default is empty
* // - currently supported: 'mysql', 'postgres', 'mssql' * // - currently supported: 'mysql', 'postgres', 'mssql'
...@@ -77,20 +77,20 @@ class Sequelize { ...@@ -77,20 +77,20 @@ class Sequelize {
* supportBigNumbers: true, * supportBigNumbers: true,
* bigNumberStrings: true * bigNumberStrings: true
* }, * },
* *
* // the storage engine for sqlite * // the storage engine for sqlite
* // - default ':memory:' * // - default ':memory:'
* storage: 'path/to/database.sqlite', * storage: 'path/to/database.sqlite',
* *
* // disable inserting undefined values as NULL * // disable inserting undefined values as NULL
* // - default: false * // - default: false
* omitNull: true, * omitNull: true,
* *
* // a flag for using a native library or not. * // a flag for using a native library or not.
* // in the case of 'pg' -- set this to true will allow SSL support * // in the case of 'pg' -- set this to true will allow SSL support
* // - default: false * // - default: false
* native: true, * native: true,
* *
* // Specify options, which are used when sequelize.define is called. * // Specify options, which are used when sequelize.define is called.
* // The following example: * // The following example:
* // define: { timestamps: false } * // define: { timestamps: false }
...@@ -107,26 +107,26 @@ class Sequelize { ...@@ -107,26 +107,26 @@ class Sequelize {
* }, * },
* timestamps: true * timestamps: true
* }, * },
* *
* // similar for sync: you can define this to always force sync for models * // similar for sync: you can define this to always force sync for models
* sync: { force: true }, * sync: { force: true },
* *
* // pool configuration used to pool database connections * // pool configuration used to pool database connections
* pool: { * pool: {
* max: 5, * max: 5,
* idle: 30000, * idle: 30000,
* acquire: 60000, * acquire: 60000,
* }, * },
* *
* // isolation level of each transaction * // isolation level of each transaction
* // defaults to dialect default * // defaults to dialect default
* isolationLevel: Transaction.ISOLATION_LEVELS.REPEATABLE_READ * isolationLevel: Transaction.ISOLATION_LEVELS.REPEATABLE_READ
* }) * })
* *
* @param {string} [database] The name of the database * @param {string} [database] The name of the database
* @param {string} [username=null] The username which is used to authenticate against the database. * @param {string} [username=null] The username which is used to authenticate against the database.
* @param {string} [password=null] The password which is used to authenticate against the database. Supports SQLCipher encryption for SQLite. * @param {string} [password=null] The password which is used to authenticate against the database. Supports SQLCipher encryption for SQLite.
* @param {Object} [options={}] An object with options. * @param {object} [options={}] An object with options.
* @param {string} [options.host='localhost'] The host of the relational database. * @param {string} [options.host='localhost'] The host of the relational database.
* @param {number} [options.port=] The port of the relational database. * @param {number} [options.port=] The port of the relational database.
* @param {string} [options.username=null] The username which is used to authenticate against the database. * @param {string} [options.username=null] The username which is used to authenticate against the database.
...@@ -135,14 +135,14 @@ class Sequelize { ...@@ -135,14 +135,14 @@ class Sequelize {
* @param {string} [options.dialect] The dialect of the database you are connecting to. One of mysql, postgres, sqlite and mssql. * @param {string} [options.dialect] The dialect of the database you are connecting to. One of mysql, postgres, sqlite and mssql.
* @param {string} [options.dialectModule=null] If specified, use this dialect library. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify 'require("pg.js")' here * @param {string} [options.dialectModule=null] If specified, use this dialect library. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify 'require("pg.js")' here
* @param {string} [options.dialectModulePath=null] If specified, load the dialect library from this path. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify '/path/to/pg.js' here * @param {string} [options.dialectModulePath=null] If specified, load the dialect library from this path. For example, if you want to use pg.js instead of pg when connecting to a pg database, you should specify '/path/to/pg.js' here
* @param {Object} [options.dialectOptions] An object of additional options, which are passed directly to the connection library * @param {object} [options.dialectOptions] An object of additional options, which are passed directly to the connection library
* @param {string} [options.storage] Only used by sqlite. Defaults to ':memory:' * @param {string} [options.storage] Only used by sqlite. Defaults to ':memory:'
* @param {string} [options.protocol='tcp'] The protocol of the relational database. * @param {string} [options.protocol='tcp'] The protocol of the relational database.
* @param {Object} [options.define={}] Default options for model definitions. See {@link Model.init}. * @param {object} [options.define={}] Default options for model definitions. See {@link Model.init}.
* @param {Object} [options.query={}] Default options for sequelize.query * @param {object} [options.query={}] Default options for sequelize.query
* @param {string} [options.schema=null] A schema to use * @param {string} [options.schema=null] A schema to use
* @param {Object} [options.set={}] Default options for sequelize.set * @param {object} [options.set={}] Default options for sequelize.set
* @param {Object} [options.sync={}] Default options for sequelize.sync * @param {object} [options.sync={}] Default options for sequelize.sync
* @param {string} [options.timezone='+00:00'] The timezone used when converting a date from the database into a JavaScript date. The timezone is also used to SET TIMEZONE when connecting to the server, to ensure that the result of NOW, CURRENT_TIMESTAMP and other time related functions have in the right timezone. For best cross platform performance use the format +/-HH:MM. Will also accept string versions of timezones used by moment.js (e.g. 'America/Los_Angeles'); this is useful to capture daylight savings time changes. * @param {string} [options.timezone='+00:00'] The timezone used when converting a date from the database into a JavaScript date. The timezone is also used to SET TIMEZONE when connecting to the server, to ensure that the result of NOW, CURRENT_TIMESTAMP and other time related functions have in the right timezone. For best cross platform performance use the format +/-HH:MM. Will also accept string versions of timezones used by moment.js (e.g. 'America/Los_Angeles'); this is useful to capture daylight savings time changes.
* @param {string|boolean} [options.clientMinMessages='warning'] The PostgreSQL `client_min_messages` session parameter. Set to `false` to not override the database's default. * @param {string|boolean} [options.clientMinMessages='warning'] The PostgreSQL `client_min_messages` session parameter. Set to `false` to not override the database's default.
* @param {boolean} [options.standardConformingStrings=true] The PostgreSQL `standard_conforming_strings` session parameter. Set to `false` to not set the option. WARNING: Setting this to false may expose vulnerabilities and is not recommended! * @param {boolean} [options.standardConformingStrings=true] The PostgreSQL `standard_conforming_strings` session parameter. Set to `false` to not set the option. WARNING: Setting this to false may expose vulnerabilities and is not recommended!
...@@ -151,7 +151,7 @@ class Sequelize { ...@@ -151,7 +151,7 @@ class Sequelize {
* @param {boolean} [options.omitNull=false] A flag that defines if null values should be passed to SQL queries or not. * @param {boolean} [options.omitNull=false] A flag that defines if null values should be passed to SQL queries or not.
* @param {boolean} [options.native=false] A flag that defines if native library shall be used or not. Currently only has an effect for postgres * @param {boolean} [options.native=false] A flag that defines if native library shall be used or not. Currently only has an effect for postgres
* @param {boolean} [options.replication=false] Use read / write replication. To enable replication, pass an object, with two properties, read and write. Write should be an object (a single server for handling writes), and read an array of object (several servers to handle reads). Each read/write server can have the following properties: `host`, `port`, `username`, `password`, `database` * @param {boolean} [options.replication=false] Use read / write replication. To enable replication, pass an object, with two properties, read and write. Write should be an object (a single server for handling writes), and read an array of object (several servers to handle reads). Each read/write server can have the following properties: `host`, `port`, `username`, `password`, `database`
* @param {Object} [options.pool] sequelize connection pool configuration * @param {object} [options.pool] sequelize connection pool configuration
* @param {number} [options.pool.max=5] Maximum number of connection in pool * @param {number} [options.pool.max=5] Maximum number of connection in pool
* @param {number} [options.pool.min=0] Minimum number of connection in pool * @param {number} [options.pool.min=0] Minimum number of connection in pool
* @param {number} [options.pool.idle=10000] The maximum time, in milliseconds, that a connection can be idle before being released. * @param {number} [options.pool.idle=10000] The maximum time, in milliseconds, that a connection can be idle before being released.
...@@ -161,11 +161,11 @@ class Sequelize { ...@@ -161,11 +161,11 @@ class Sequelize {
* @param {boolean} [options.quoteIdentifiers=true] Set to `false` to make table names and attributes case-insensitive on Postgres and skip double quoting of them. WARNING: Setting this to false may expose vulnerabilities and is not recommended! * @param {boolean} [options.quoteIdentifiers=true] Set to `false` to make table names and attributes case-insensitive on Postgres and skip double quoting of them. WARNING: Setting this to false may expose vulnerabilities and is not recommended!
* @param {string} [options.transactionType='DEFERRED'] Set the default transaction type. See `Sequelize.Transaction.TYPES` for possible options. Sqlite only. * @param {string} [options.transactionType='DEFERRED'] Set the default transaction type. See `Sequelize.Transaction.TYPES` for possible options. Sqlite only.
* @param {string} [options.isolationLevel] Set the default transaction isolation level. See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options. * @param {string} [options.isolationLevel] Set the default transaction isolation level. See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options.
* @param {Object} [options.retry] Set of flags that control when a query is automatically retried. * @param {object} [options.retry] Set of flags that control when a query is automatically retried.
* @param {Array} [options.retry.match] Only retry a query if the error matches one of these strings. * @param {Array} [options.retry.match] Only retry a query if the error matches one of these strings.
* @param {number} [options.retry.max] How many times a failing query is automatically retried. Set to 0 to disable retrying on SQL_BUSY error. * @param {number} [options.retry.max] How many times a failing query is automatically retried. Set to 0 to disable retrying on SQL_BUSY error.
* @param {boolean} [options.typeValidation=false] Run built in type validators on insert and update, e.g. validate that arguments passed to integer fields are integer-like. * @param {boolean} [options.typeValidation=false] Run built in type validators on insert and update, e.g. validate that arguments passed to integer fields are integer-like.
* @param {Object} [options.hooks] An object of global hook functions that are called before and after certain lifecycle events. Global hooks will run after any model-specific hooks defined for the same event (See `Sequelize.Model.init()` for a list). Additionally, `beforeConnect()` and `afterConnect()` hooks may be defined here. * @param {object} [options.hooks] An object of global hook functions that are called before and after certain lifecycle events. Global hooks will run after any model-specific hooks defined for the same event (See `Sequelize.Model.init()` for a list). Additionally, `beforeConnect()` and `afterConnect()` hooks may be defined here.
*/ */
constructor(database, username, password, options) { constructor(database, username, password, options) {
let config; let config;
...@@ -379,8 +379,8 @@ class Sequelize { ...@@ -379,8 +379,8 @@ class Sequelize {
* The table columns are defined by the object that is given as the second argument. Each key of the object represents a column * The table columns are defined by the object that is given as the second argument. Each key of the object represents a column
* *
* @param {string} modelName The name of the model. The model will be stored in `sequelize.models` under this name * @param {string} modelName The name of the model. The model will be stored in `sequelize.models` under this name
* @param {Object} attributes An object, where each attribute is a column of the table. See {@link Model.init} * @param {object} attributes An object, where each attribute is a column of the table. See {@link Model.init}
* @param {Object} [options] These options are merged with the default define options provided to the Sequelize constructor and passed to Model.init() * @param {object} [options] These options are merged with the default define options provided to the Sequelize constructor and passed to Model.init()
* *
* @see * @see
* {@link Model.init} for a more comprehensive specification of the `options` and `attributes` objects. * {@link Model.init} for a more comprehensive specification of the `options` and `attributes` objects.
...@@ -498,25 +498,25 @@ class Sequelize { ...@@ -498,25 +498,25 @@ class Sequelize {
* ``` * ```
* *
* @param {string} sql * @param {string} sql
* @param {Object} [options={}] Query options. * @param {object} [options={}] Query options.
* @param {boolean} [options.raw] If true, sequelize will not try to format the results of the query, or build an instance of a model from the result * @param {boolean} [options.raw] If true, sequelize will not try to format the results of the query, or build an instance of a model from the result
* @param {Transaction} [options.transaction=null] The transaction that the query should be executed under * @param {Transaction} [options.transaction=null] The transaction that the query should be executed under
* @param {QueryTypes} [options.type='RAW'] The type of query you are executing. The query type affects how results are formatted before they are passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. * @param {QueryTypes} [options.type='RAW'] The type of query you are executing. The query type affects how results are formatted before they are passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts.
* @param {boolean} [options.nest=false] If true, transforms objects with `.` separated property names into nested objects using [dottie.js](https://github.com/mickhansen/dottie.js). For example { 'user.username': 'john' } becomes { user: { username: 'john' }}. When `nest` is true, the query type is assumed to be `'SELECT'`, unless otherwise specified * @param {boolean} [options.nest=false] If true, transforms objects with `.` separated property names into nested objects using [dottie.js](https://github.com/mickhansen/dottie.js). For example { 'user.username': 'john' } becomes { user: { username: 'john' }}. When `nest` is true, the query type is assumed to be `'SELECT'`, unless otherwise specified
* @param {boolean} [options.plain=false] Sets the query type to `SELECT` and return a single row * @param {boolean} [options.plain=false] Sets the query type to `SELECT` and return a single row
* @param {Object|Array} [options.replacements] Either an object of named parameter replacements in the format `:param` or an array of unnamed replacements to replace `?` in your SQL. * @param {object|Array} [options.replacements] Either an object of named parameter replacements in the format `:param` or an array of unnamed replacements to replace `?` in your SQL.
* @param {Object|Array} [options.bind] Either an object of named bind parameter in the format `_param` or an array of unnamed bind parameter to replace `$1, $2, ...` in your SQL. * @param {object|Array} [options.bind] Either an object of named bind parameter in the format `_param` or an array of unnamed bind parameter to replace `$1, $2, ...` in your SQL.
* @param {boolean} [options.useMaster=false] Force the query to use the write pool, regardless of the query type. * @param {boolean} [options.useMaster=false] Force the query to use the write pool, regardless of the query type.
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {new Model()} [options.instance] A sequelize instance used to build the return instance * @param {new Model()} [options.instance] A sequelize instance used to build the return instance
* @param {Model} [options.model] A sequelize model used to build the returned model instances (used to be called callee) * @param {Model} [options.model] A sequelize model used to build the returned model instances (used to be called callee)
* @param {Object} [options.retry] Set of flags that control when a query is automatically retried. * @param {object} [options.retry] Set of flags that control when a query is automatically retried.
* @param {Array} [options.retry.match] Only retry a query if the error matches one of these strings. * @param {Array} [options.retry.match] Only retry a query if the error matches one of these strings.
* @param {Integer} [options.retry.max] How many times a failing query is automatically retried. * @param {Integer} [options.retry.max] How many times a failing query is automatically retried.
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only) * @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* @param {boolean} [options.supportsSearchPath] If false do not prepend the query with the search_path (Postgres only) * @param {boolean} [options.supportsSearchPath] If false do not prepend the query with the search_path (Postgres only)
* @param {boolean} [options.mapToModel=false] Map returned fields to model's fields if `options.model` or `options.instance` is present. Mapping will occur before building the model instance. * @param {boolean} [options.mapToModel=false] Map returned fields to model's fields if `options.model` or `options.instance` is present. Mapping will occur before building the model instance.
* @param {Object} [options.fieldMap] Map returned fields to arbitrary names for `SELECT` query type. * @param {object} [options.fieldMap] Map returned fields to arbitrary names for `SELECT` query type.
* *
* @returns {Promise} * @returns {Promise}
* *
...@@ -640,8 +640,8 @@ class Sequelize { ...@@ -640,8 +640,8 @@ class Sequelize {
* Execute a query which would set an environment or user variable. The variables are set per connection, so this function needs a transaction. * Execute a query which would set an environment or user variable. The variables are set per connection, so this function needs a transaction.
* Only works for MySQL. * Only works for MySQL.
* *
* @param {Object} variables Object with multiple variables. * @param {object} variables Object with multiple variables.
* @param {Object} [options] query options. * @param {object} [options] query options.
* @param {Transaction} [options.transaction] The transaction that the query should be executed under * @param {Transaction} [options.transaction] The transaction that the query should be executed under
* *
* @memberof Sequelize * @memberof Sequelize
...@@ -694,7 +694,7 @@ class Sequelize { ...@@ -694,7 +694,7 @@ class Sequelize {
* {@link Model.schema} * {@link Model.schema}
* *
* @param {string} schema Name of the schema * @param {string} schema Name of the schema
* @param {Object} [options={}] query options * @param {object} [options={}] query options
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* *
* @returns {Promise} * @returns {Promise}
...@@ -709,7 +709,7 @@ class Sequelize { ...@@ -709,7 +709,7 @@ class Sequelize {
* **Note:** this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), * **Note:** this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html),
* not a database table. In mysql and sqlite, this will show all tables. * not a database table. In mysql and sqlite, this will show all tables.
* *
* @param {Object} [options={}] query options * @param {object} [options={}] query options
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* *
* @returns {Promise} * @returns {Promise}
...@@ -725,7 +725,7 @@ class Sequelize { ...@@ -725,7 +725,7 @@ class Sequelize {
* not a database table. In mysql and sqlite, this drop a table matching the schema name * not a database table. In mysql and sqlite, this drop a table matching the schema name
* *
* @param {string} schema Name of the schema * @param {string} schema Name of the schema
* @param {Object} [options={}] query options * @param {object} [options={}] query options
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* *
* @returns {Promise} * @returns {Promise}
...@@ -740,7 +740,7 @@ class Sequelize { ...@@ -740,7 +740,7 @@ class Sequelize {
* **Note:** this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html), * **Note:** this is a schema in the [postgres sense of the word](http://www.postgresql.org/docs/9.1/static/ddl-schemas.html),
* not a database table. In mysql and sqlite, this is the equivalent of drop all tables. * not a database table. In mysql and sqlite, this is the equivalent of drop all tables.
* *
* @param {Object} [options={}] query options * @param {object} [options={}] query options
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* *
* @returns {Promise} * @returns {Promise}
...@@ -752,7 +752,7 @@ class Sequelize { ...@@ -752,7 +752,7 @@ class Sequelize {
/** /**
* Sync all defined models to the DB. * Sync all defined models to the DB.
* *
* @param {Object} [options={}] sync options * @param {object} [options={}] sync options
* @param {boolean} [options.force=false] If force is true, each Model will run `DROP TABLE IF EXISTS`, before it tries to create its own table * @param {boolean} [options.force=false] If force is true, each Model will run `DROP TABLE IF EXISTS`, before it tries to create its own table
* @param {RegExp} [options.match] Match a regex against the database name before syncing, a safety check for cases where force: true is used in tests but not live code * @param {RegExp} [options.match] Match a regex against the database name before syncing, a safety check for cases where force: true is used in tests but not live code
* @param {boolean|Function} [options.logging=console.log] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging=console.log] A function that logs sql queries, or false for no logging
...@@ -813,7 +813,7 @@ class Sequelize { ...@@ -813,7 +813,7 @@ class Sequelize {
* Truncate all tables defined through the sequelize models. * Truncate all tables defined through the sequelize models.
* This is done by calling `Model.truncate()` on each model. * This is done by calling `Model.truncate()` on each model.
* *
* @param {Object} [options] The options passed to Model.destroy in addition to truncate * @param {object} [options] The options passed to Model.destroy in addition to truncate
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* @returns {Promise} * @returns {Promise}
* *
...@@ -844,7 +844,7 @@ class Sequelize { ...@@ -844,7 +844,7 @@ class Sequelize {
* @see * @see
* {@link Model.drop} for options * {@link Model.drop} for options
* *
* @param {Object} [options] The options passed to each call to Model.drop * @param {object} [options] The options passed to each call to Model.drop
* @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging * @param {boolean|Function} [options.logging] A function that logs sql queries, or false for no logging
* *
* @returns {Promise} * @returns {Promise}
...@@ -864,7 +864,7 @@ class Sequelize { ...@@ -864,7 +864,7 @@ class Sequelize {
/** /**
* Test the connection by trying to authenticate. It runs `SELECT 1+1 AS result` query. * Test the connection by trying to authenticate. It runs `SELECT 1+1 AS result` query.
* *
* @param {Object} [options={}] query options * @param {object} [options={}] query options
* *
* @returns {Promise} * @returns {Promise}
*/ */
...@@ -971,7 +971,7 @@ class Sequelize { ...@@ -971,7 +971,7 @@ class Sequelize {
* @see * @see
* {@link Model.findAll} * {@link Model.findAll}
* *
* @param {...string|Object} args Each argument will be joined by AND * @param {...string|object} args Each argument will be joined by AND
* @since v2.0.0-dev3 * @since v2.0.0-dev3
* @memberof Sequelize * @memberof Sequelize
* *
...@@ -987,7 +987,7 @@ class Sequelize { ...@@ -987,7 +987,7 @@ class Sequelize {
* @see * @see
* {@link Model.findAll} * {@link Model.findAll}
* *
* @param {...string|Object} args Each argument will be joined by OR * @param {...string|object} args Each argument will be joined by OR
* @since v2.0.0-dev3 * @since v2.0.0-dev3
* @memberof Sequelize * @memberof Sequelize
* *
...@@ -1003,7 +1003,7 @@ class Sequelize { ...@@ -1003,7 +1003,7 @@ class Sequelize {
* @see * @see
* {@link Model.findAll} * {@link Model.findAll}
* *
* @param {string|Object} conditionsOrPath A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres/sqlite/mysql json syntax. * @param {string|object} conditionsOrPath A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres/sqlite/mysql json syntax.
* @param {string|number|boolean} [value] An optional value to compare against. Produces a string of the form "<json path> = '<value>'". * @param {string|number|boolean} [value] An optional value to compare against. Produces a string of the form "<json path> = '<value>'".
* @memberof Sequelize * @memberof Sequelize
* *
...@@ -1024,9 +1024,9 @@ class Sequelize { ...@@ -1024,9 +1024,9 @@ class Sequelize {
* @see * @see
* {@link Model.findAll} * {@link Model.findAll}
* *
* @param {Object} attr The attribute, which can be either an attribute object from `Model.rawAttributes` or a sequelize object, for example an instance of `sequelize.fn`. For simple string attributes, use the POJO syntax * @param {object} attr The attribute, which can be either an attribute object from `Model.rawAttributes` or a sequelize object, for example an instance of `sequelize.fn`. For simple string attributes, use the POJO syntax
* @param {Symbol} [comparator='Op.eq'] operator * @param {Symbol} [comparator='Op.eq'] operator
* @param {string|Object} logic The condition. Can be both a simply type, or a further condition (`or`, `and`, `.literal` etc.) * @param {string|object} logic The condition. Can be both a simply type, or a further condition (`or`, `and`, `.literal` etc.)
* @since v2.0.0-dev3 * @since v2.0.0-dev3
*/ */
static where(attr, comparator, logic) { static where(attr, comparator, logic) {
...@@ -1044,7 +1044,7 @@ class Sequelize { ...@@ -1044,7 +1044,7 @@ class Sequelize {
* .catch(() => transaction.rollback()); * .catch(() => transaction.rollback());
* }) * })
* *
* @param {Object} [options] Transaction options * @param {object} [options] Transaction options
* @param {string} [options.type='DEFERRED'] See `Sequelize.Transaction.TYPES` for possible options. Sqlite only. * @param {string} [options.type='DEFERRED'] See `Sequelize.Transaction.TYPES` for possible options. Sqlite only.
* @param {string} [options.isolationLevel] See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options * @param {string} [options.isolationLevel] See `Sequelize.Transaction.ISOLATION_LEVELS` for possible options
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
...@@ -1270,7 +1270,7 @@ Sequelize.prototype.Association = Sequelize.Association = Association; ...@@ -1270,7 +1270,7 @@ Sequelize.prototype.Association = Sequelize.Association = Association;
/** /**
* Provide alternative version of `inflection` module to be used by `Utils.pluralize` etc. * Provide alternative version of `inflection` module to be used by `Utils.pluralize` etc.
* @param {Object} _inflection - `inflection` module * @param {object} _inflection - `inflection` module
*/ */
Sequelize.useInflection = Utils.useInflection; Sequelize.useInflection = Utils.useInflection;
......
...@@ -15,7 +15,7 @@ class Transaction { ...@@ -15,7 +15,7 @@ class Transaction {
* Creates a new transaction instance * Creates a new transaction instance
* *
* @param {Sequelize} sequelize A configured sequelize Instance * @param {Sequelize} sequelize A configured sequelize Instance
* @param {Object} options An object with options * @param {object} options An object with options
* @param {string} options.type=true Sets the type of the transaction. * @param {string} options.type=true Sets the type of the transaction.
* @param {string} options.isolationLevel=true Sets the isolation level of the transaction. * @param {string} options.isolationLevel=true Sets the isolation level of the transaction.
* @param {string} options.deferrable Sets the constraints to be deferred or immediately checked. * @param {string} options.deferrable Sets the constraints to be deferred or immediately checked.
...@@ -264,7 +264,7 @@ class Transaction { ...@@ -264,7 +264,7 @@ class Transaction {
* }); * });
* # The query will now return any rows that aren't locked by another transaction * # The query will now return any rows that aren't locked by another transaction
* *
* @returns {Object} * @returns {object}
* @property UPDATE * @property UPDATE
* @property SHARE * @property SHARE
* @property KEY_SHARE Postgres 9.3+ only * @property KEY_SHARE Postgres 9.3+ only
......
...@@ -380,8 +380,8 @@ exports.removeTicks = removeTicks; ...@@ -380,8 +380,8 @@ exports.removeTicks = removeTicks;
* address.coordinates.longitude: 12.5964313 * address.coordinates.longitude: 12.5964313
* } * }
* *
* @param {Object} value an Object * @param {object} value an Object
* @returns {Object} a flattened object * @returns {object} a flattened object
* @private * @private
*/ */
function flattenObjectDeep(value) { function flattenObjectDeep(value) {
...@@ -488,7 +488,7 @@ exports.Where = Where; ...@@ -488,7 +488,7 @@ exports.Where = Where;
/** /**
* getOperators * getOperators
* *
* @param {Object} obj * @param {object} obj
* @returns {Array<Symbol>} All operators properties of obj * @returns {Array<Symbol>} All operators properties of obj
* @private * @private
*/ */
...@@ -500,7 +500,7 @@ exports.getOperators = getOperators; ...@@ -500,7 +500,7 @@ exports.getOperators = getOperators;
/** /**
* getComplexKeys * getComplexKeys
* *
* @param {Object} obj * @param {object} obj
* @returns {Array<string|Symbol>} All keys including operators * @returns {Array<string|Symbol>} All keys including operators
* @private * @private
*/ */
...@@ -512,7 +512,7 @@ exports.getComplexKeys = getComplexKeys; ...@@ -512,7 +512,7 @@ exports.getComplexKeys = getComplexKeys;
/** /**
* getComplexSize * getComplexSize
* *
* @param {Object|Array} obj * @param {object|Array} obj
* @returns {number} Length of object properties including operators if obj is array returns its length * @returns {number} Length of object properties including operators if obj is array returns its length
* @private * @private
*/ */
...@@ -524,7 +524,7 @@ exports.getComplexSize = getComplexSize; ...@@ -524,7 +524,7 @@ exports.getComplexSize = getComplexSize;
/** /**
* Returns true if a where clause is empty, even with Symbols * Returns true if a where clause is empty, even with Symbols
* *
* @param {Object} obj * @param {object} obj
* @returns {boolean} * @returns {boolean}
* @private * @private
*/ */
...@@ -549,7 +549,7 @@ exports.generateEnumName = generateEnumName; ...@@ -549,7 +549,7 @@ exports.generateEnumName = generateEnumName;
/** /**
* Returns an new Object which keys are camelized * Returns an new Object which keys are camelized
* *
* @param {Object} obj * @param {object} obj
* @returns {string} * @returns {string}
* @private * @private
*/ */
...@@ -570,9 +570,9 @@ exports.camelizeObjectKeys = camelizeObjectKeys; ...@@ -570,9 +570,9 @@ exports.camelizeObjectKeys = camelizeObjectKeys;
* *
* **Note:** This method mutates `object`. * **Note:** This method mutates `object`.
* *
* @param {Object} object The destination object. * @param {object} object The destination object.
* @param {...Object} [sources] The source objects. * @param {...object} [sources] The source objects.
* @returns {Object} Returns `object`. * @returns {object} Returns `object`.
* @private * @private
*/ */
function defaults(object, ...sources) { function defaults(object, ...sources) {
...@@ -602,12 +602,12 @@ exports.defaults = defaults; ...@@ -602,12 +602,12 @@ exports.defaults = defaults;
/** /**
* *
* @param {Object} index * @param {object} index
* @param {Array} index.fields * @param {Array} index.fields
* @param {string} [index.name] * @param {string} [index.name]
* @param {string|Object} tableName * @param {string|object} tableName
* *
* @returns {Object} * @returns {object}
* @private * @private
*/ */
function nameIndex(index, tableName) { function nameIndex(index, tableName) {
......
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
"wkx": "^0.4.6" "wkx": "^0.4.6"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^7.6.1", "@commitlint/cli": "^8.0.0",
"@commitlint/config-angular": "^7.6.0", "@commitlint/config-angular": "^8.0.0",
"@types/bluebird": "^3.5.26", "@types/bluebird": "^3.5.26",
"@types/node": "^10.14.6", "@types/node": "^12.0.8",
"@types/validator": "^10.11.0", "@types/validator": "^10.11.0",
"big-integer": "^1.6.42", "big-integer": "^1.6.42",
"chai": "^4.x", "chai": "^4.x",
...@@ -62,14 +62,14 @@ ...@@ -62,14 +62,14 @@
"esdoc-inject-style-plugin": "^1.0.0", "esdoc-inject-style-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0", "esdoc-standard-plugin": "^1.0.0",
"eslint": "^5.15.0", "eslint": "^5.15.0",
"eslint-plugin-jsdoc": "^4.8.4", "eslint-plugin-jsdoc": "^8.0.1",
"eslint-plugin-mocha": "^5.2.1", "eslint-plugin-mocha": "^5.2.1",
"husky": "^2.2.0", "husky": "^2.2.0",
"js-combinatorics": "^0.5.4", "js-combinatorics": "^0.5.4",
"lcov-result-merger": "^3.0.0", "lcov-result-merger": "^3.0.0",
"lint-staged": "^8.1.6", "lint-staged": "^8.1.6",
"mariadb": "^2.0.5", "mariadb": "^2.0.5",
"markdownlint-cli": "^0.15.0", "markdownlint-cli": "^0.16.0",
"mocha": "^6.0.2", "mocha": "^6.0.2",
"mysql2": "^1.6.5", "mysql2": "^1.6.5",
"nyc": "^13.3.0", "nyc": "^13.3.0",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!