Optional
benchmarkPass query execution time in milliseconds as second argument to logging function (options.logging).
Optional
databaseThe version of the Database Sequelize will connect to. If unspecified, or set to 0, Sequelize will retrieve it during its first connection to the Database.
Optional
defaultThe precision for the createdAt
/updatedAt
/deletedAt
DATETIME columns that Sequelize adds to models.
Can be a number between 0 and 6, or null to use the default precision of the database. Defaults to 6.
6
Optional
defaultHow nested transaction blocks behave by default. See ManagedTransactionOptions#nestMode for more information.
TransactionNestMode.reuse
Optional
defineDefault options for model definitions. See Model.init.
The dialect of the database you are connecting to. Either the name of the dialect, or a dialect class.
Optional
disableDisable the use of AsyncLocalStorage to automatically pass transactions started by Sequelize#transaction. You will need to pass transactions around manually if you disable this.
Optional
hooksSets global permanent hooks.
Optional
isolationSet the default transaction isolation level. If not set, does not change the database's default transaction isolation level.
Optional
keepA flag that defines if the default timezone is used to convert dates from the database.
false
Optional
logSet to true
to show bind parameters in log.
false
Optional
loggingA function that gets executed while running the query to log the sql.
Optional
timing: numberOptional
minifySet to true
to automatically minify aliases generated by sequelize.
Mostly useful to circumvent the POSTGRES alias limit of 64 characters.
false
Optional
modelsA list of models to load and init.
This option is only useful if you created your models using decorators. Models created using Model.init or Sequelize#define don't need to be specified in this option.
Use importModels to load models dynamically:
import { User } from './models/user.js';
new Sequelize({
models: [User],
});
new Sequelize({
models: await importModels(__dirname + '/*.model.ts'),
});
Optional
noDisable built in type validators on insert and update, e.g. don't validate that arguments passed to integer fields are integer-like.
false
Optional
nullWhen representing the JavaScript null primitive in a JSON column, Sequelize can use either the SQL NULL value, or a JSON 'null'.
Set this to "json" if you want the null to be stored as a JSON 'null'. Set this to "sql" if you want the null to be stored as the SQL NULL value. Set this to "explicit" if you don't want Sequelize to make any assumptions. This means that you won't be able to use the JavaScript null primitive as the top level value of a JSON column, you will have to use SQL_NULL or JSON_NULL instead.
This only impacts serialization when inserting or updating values. Comparing always requires to be explicit.
Read more: https://sequelize.org/docs/v7/querying/json/
json
Optional
omitA flag that defines if null values should be passed to SQL queries or not.
false
Optional
poolConnection pool options
Optional
prependOptional
queryDefault options for sequelize.query
Optional
quoteSet to false
to make table names and attributes case-insensitive on Postgres and skip double quoting of
them.
true
Optional
replicationUse 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
. Connection strings can be used instead of objects.
false
Optional
retryOptional
schemaIf defined, the connection will use the provided schema instead of the default ("public").
Optional
setDefault options for sequelize.set
Optional
syncDefault options for sequelize.sync
Optional
timezoneThe 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 supported by Intl.Locale (e.g. 'America/Los_Angeles'); this is useful to capture daylight savings time changes.
'+00:00'
Optional
transactionSet the default transaction type. See Sequelize.Transaction.TYPES for possible options. Sqlite only.
'DEFERRED'
Optional
urlThe connection URL. If other connection options are set, they will override the values set in this URL.
Options of the Sequelize constructor used by the core library.
See Options for the full list of options, including those dialect-specific.