Instantiate sequelize with name of database, username and password
// without password and options
var sequelize = new Sequelize('database', 'username')
// without options
var sequelize = new Sequelize('database', 'username', 'password')
// without password / with blank password
var sequelize = new Sequelize('database', 'username', null, {})
// with password and options
var sequelize = new Sequelize('my_database', 'john', 'doe', {})
// with uri (see below)
var sequelize = new Sequelize('mysql://localhost:3306/database', {})
The name of the database
The username which is used to authenticate against the database.
The password which is used to authenticate against the database.
An object with options.
Instantiate sequelize with name of database, username and password Instantiate sequelize with an URI
// without password and options
var sequelize = new Sequelize('database', 'username')
// without options
var sequelize = new Sequelize('database', 'username', 'password')
// without password / with blank password
var sequelize = new Sequelize('database', 'username', null, {})
// with password and options
var sequelize = new Sequelize('my_database', 'john', 'doe', {})
// with uri (see below)
var sequelize = new Sequelize('mysql://localhost:3306/database', {})
The name of the database
The username which is used to authenticate against the database.
An object with options.
Instantiate sequelize with an URI
// without password and options
var sequelize = new Sequelize('database', 'username')
// without options
var sequelize = new Sequelize('database', 'username', 'password')
// without password / with blank password
var sequelize = new Sequelize('database', 'username', null, {})
// with password and options
var sequelize = new Sequelize('my_database', 'john', 'doe', {})
// with uri (see below)
var sequelize = new Sequelize('mysql://localhost:3306/database', {})
A full database URI
An object with options.
A reference to the deferrable collection. Use this to access the different deferrable options.
A reference to the sequelize instance class.
A Model represents a table in the database. Sometimes you might also see it referred to as model, or simply as factory. This class should not be instantiated directly, it is created using sequelize.define, and already created models can be loaded using sequelize.import
A modified version of bluebird promises, that allows listening for sql events
Available query types for use with sequelize.query
A reference to the sequelize transaction class. Use this to access isolationLevels when creating a transaction
A reference to sequelize utilities. Most users will not need to use these utils directly. However, you
might want to use Sequelize.Utils._
, which is a reference to the lodash library, if you don't already
have it imported in your project.
Exposes the validator.js object, so you can extend it with custom validation functions. The validator is exposed both on the instance, and on the constructor.
Provide access to continuation-local-storage (http://docs.sequelizejs.com/en/latest/api/sequelize/#transactionoptions-promise)
An AND query
Each argument will be joined by AND
Creates a object representing a call to the cast function.
The value to cast
The type to cast it to
Creates a object representing a column in the DB. This is often useful in conjunction with
sequelize.fn
, since raw string arguments to fn will be escaped.
The name of the column
Creates a object representing a database function. This can be used in search queries, both in where and
order parts, and as default values in column definitions. If you want to refer to columns in your
function, you should use sequelize.col
, so that the columns are properly interpreted as columns and
not a strings.
Convert a user's username to upper case
instance.updateAttributes({
username: self.sequelize.fn('upper', self.sequelize.col('username'))
})
The function you want to call
All further arguments will be passed as arguments to the function
Creates an object representing nested where conditions for postgres's json data-type.
A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres json syntax.
An optional value to compare against. Produces a string of the form "
Creates a object representing a literal, i.e. something that will not be escaped.
An OR query
Each argument will be joined by OR
A way of specifying attr = condition.
The attr can either be an object taken from Model.rawAttributes
(for example Model.rawAttributes.id
or
Model.rawAttributes.name
). The attribute should be defined in your model definition. The attribute can
also be an object from one of the sequelize utility functions (sequelize.fn
, sequelize.col
etc.)
For string attributes, use the regular { where: { attr: something }}
syntax. If you don't want your
string to be escaped, use sequelize.literal
.
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
Comparator
The condition. Can be both a simply type, or a further condition (.or
, .and
, .literal
etc.)
Generated using TypeDoc
Sequelize methods available only for the static class ( basically this is the constructor and some extends )