* Sync this Model to the DB, that is create the table. Upon success, the callback will be called with the model instance (this)
* Sync this Model to the DB, that is create the table.
* Upon success, the callback will be called with the model instance (this)
*
* @see {@link Sequelize#sync} for options
* @see {@link Sequelize#sync} for options
*
* @return {Promise<this>}
* @return {Promise<this>}
*/
*/
staticsync(options){
staticsync(options){
...
@@ -1316,10 +1319,12 @@ class Model {
...
@@ -1316,10 +1319,12 @@ class Model {
/**
/**
* Drop the table represented by this Model
* Drop the table represented by this Model
*
* @param {Object} [options]
* @param {Object} [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).
*
* @return {Promise}
* @return {Promise}
*/
*/
staticdrop(options){
staticdrop(options){
...
@@ -1459,7 +1464,8 @@ class Model {
...
@@ -1459,7 +1464,8 @@ class Model {
* ```
* ```
*
*
* @param {Array|Object|String|null} options 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|null} options 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.
* @return {Model} A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope.
*
* @return {Model} A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope.
*/
*/
staticscope(option){
staticscope(option){
constself=classextendsthis{};
constself=classextendsthis{};
...
@@ -1632,7 +1638,8 @@ class Model {
...
@@ -1632,7 +1638,8 @@ class Model {
* @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
*
*
* @link {@link Sequelize.query}
* @see {@link Sequelize#query}
*
* @return {Promise<Array<Model>>}
* @return {Promise<Array<Model>>}
*/
*/
staticfindAll(options){
staticfindAll(options){
...
@@ -1999,6 +2006,8 @@ class Model {
...
@@ -1999,6 +2006,8 @@ class Model {
* @param {Object} [findOptions] See findAll
* @param {Object} [findOptions] See findAll
*
*
* @see {@link Model.findAll} for a specification of find and query options
* @see {@link Model.findAll} for a specification of find and query options
* @see {@link Model.count} for a specification of count options
* Builds a new model instance and calls save on it.
* Builds a new model instance and calls save on it.
* @see {@link Model#build}
* @see {@link Model.build}
* @see {@link Model#save}
* @see {@link Model.save}
*
*
* @param {Object} values
* @param {Object} values
* @param {Object} [options]
* @param {Object} [options]
...
@@ -2185,11 +2194,13 @@ class Model {
...
@@ -2185,11 +2194,13 @@ class Model {
* However, it is not always possible to handle this case in SQLite, specifically if one transaction inserts and another tries to select before the first one has committed. In this case, an instance of sequelize. TimeoutError will be thrown instead.
* However, it is not always possible to handle this case in SQLite, specifically if one transaction inserts and another tries to select before the first one has committed. In this case, an instance of sequelize. TimeoutError will be thrown instead.
* If a transaction is created, a savepoint will be created instead, and any unique constraint violation will be handled internally.
* If a transaction is created, a savepoint will be created instead, and any unique constraint violation will be handled internally.
*
*
* @see {@link Model.findAll} for a full specification of find and options
*
* @param {Object} options
* @param {Object} 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
* @see {@link Model.findAll} for a full specification of find and options
*
* @return {Promise<Model,created>}
* @return {Promise<Model,created>}
*/
*/
staticfindOrCreate(options){
staticfindOrCreate(options){
...
@@ -2292,10 +2303,12 @@ class Model {
...
@@ -2292,10 +2303,12 @@ class Model {
* A more performant findOrCreate that will not work under a transaction (at least not in postgres)
* A more performant findOrCreate that will not work under a transaction (at least not in postgres)
* Will execute a find call, if empty then attempt to create, if unique constraint then attempt to find again
* Will execute a find call, if empty then attempt to create, if unique constraint then attempt to find again
*
*
* @param {Object} options
* @param {Object} options.where where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance
* @see {@link Model.findAll} for a full specification of find and options
* @see {@link Model.findAll} for a full specification of find and options
*
* @param {Object} options
* @param {Object} options.where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance
*
* @return {Promise<Model,created>}
* @return {Promise<Model,created>}
*/
*/
staticfindCreateFind(options){
staticfindCreateFind(options){
...
@@ -2600,7 +2613,7 @@ class Model {
...
@@ -2600,7 +2613,7 @@ class Model {
*
*
* @return {Promise}
* @return {Promise}
*
*
* @see {@link Model#destroy} for more information
* @see {@link Model.destroy} for more information
*/
*/
statictruncate(options){
statictruncate(options){
options=Utils.cloneDeep(options)||{};
options=Utils.cloneDeep(options)||{};
...
@@ -2623,6 +2636,7 @@ class Model {
...
@@ -2623,6 +2636,7 @@ class Model {
* @param {Transaction} [options.transaction] Transaction to run query under
* @param {Transaction} [options.transaction] Transaction to run query under
* @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).
*
* @return {Promise<Integer>} The number of destroyed rows
* @return {Promise<Integer>} The number of destroyed rows
* @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
*
* @return {Object|any}
* @return {Object|any}
*/
*/
get(key,options){// testhint options:none
get(key,options){// testhint options:none
...
@@ -3298,11 +3313,14 @@ class Model {
...
@@ -3298,11 +3313,14 @@ class Model {
* If called with a dot.separated key on a JSON/JSONB attribute it will set the value nested and flag the entire object as changed.
* If called with a dot.separated key on a JSON/JSONB attribute it will set the value nested and flag the entire object as changed.
*
*
* @see {@link Model.findAll} for more information about includes
* @see {@link Model.findAll} for more information about includes
*
* @param {String|Object} key
* @param {String|Object} key
* @param {any} value
* @param {any} value
* @param {Object} [options]
* @param {Object} [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
*
* @return this
*/
*/
set(key,value,options){// testhint options:none
set(key,value,options){// testhint options:none
letvalues;
letvalues;
...
@@ -3529,6 +3547,7 @@ class Model {
...
@@ -3529,6 +3547,7 @@ class Model {
* @param {Transaction} [options.transaction]
* @param {Transaction} [options.transaction]
* @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.returning] Append RETURNING * to get back auto generated values (Postgres only)
* @param {Boolean} [options.returning] Append RETURNING * to get back auto generated values (Postgres only)
*
* @return {Promise<this|Errors.ValidationError>}
* @return {Promise<this|Errors.ValidationError>}
*/
*/
save(options){
save(options){
...
@@ -3789,6 +3808,7 @@ class Model {
...
@@ -3789,6 +3808,7 @@ class Model {
* all references to the Instance are updated with the new data and no new objects are created.
* all references to the Instance are updated with the new data and no new objects are created.
*
*
* @see {@link Model.findAll}
* @see {@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.
*
*
...
@@ -3842,6 +3862,7 @@ class Model {
...
@@ -3842,6 +3862,7 @@ class Model {
*
*
* @see {@link Model#set}
* @see {@link Model#set}
* @see {@link Model#save}
* @see {@link Model#save}
*
* @param {Object} updates See `set`
* @param {Object} updates See `set`
* @param {Object} options See `save`
* @param {Object} options See `save`
*
*
...
@@ -4039,13 +4060,13 @@ class Model {
...
@@ -4039,13 +4060,13 @@ class Model {
*
*
* @see {@link Model#reload}
* @see {@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]
* @param {Object} [options]
* @param {Integer} [options.by=1] The number to decrement by
* @param {Integer} [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.
* @param {Transaction} [options.transaction]
* @param {Transaction} [options.transaction]
* @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.returning=true] Append RETURNING * to get back auto generated values (Postgres only)
* @param {Boolean} [options.returning=true] Append RETURNING * to get back auto generated values (Postgres only)