Hierarchy

  • RequiredBy<Options, "transactionType" | "isolationLevel" | "noTypeValidation" | "dialectOptions" | "dialect" | "timezone" | "disableClsTransactions" | "defaultTransactionNestMode" | "defaultTimestampPrecision">
    • NormalizedOptions

Properties

benchmark?: boolean

Pass query execution time in milliseconds as second argument to logging function (options.logging).

clientMinMessages?: string | boolean

The PostgreSQL client_min_messages session parameter. Set to false to not override the database's default.

Deprecated in v7, please use the sequelize option "dialectOptions.clientMinMessages" instead

Deprecated

Default

'warning'
database?: string

The name of the database

databaseVersion?: string

The 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.

defaultTimestampPrecision: null | number

The 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.

Default

6
defaultTransactionNestMode: TransactionNestMode

How nested transaction blocks behave by default. See ManagedTransactionOptions#nestMode for more information.

Default

TransactionNestMode.reuse
define?: Omit<ModelOptions<Model<any, any>>, "name" | "tableName" | "modelName">

Default options for model definitions. See Model.init.

dialect: Dialect

The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql.

Default

'mysql'
dialectModule?: object

If specified, will use the provided module as the dialect.

Example

`dialectModule: require('@myorg/tedious'),`
dialectModulePath?: string

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 'pg.js' here

dialectOptions: DialectOptions

An object of additional options, which are passed directly to the connection library

disableClsTransactions: boolean

Disable the use of AsyncLocalStorage to automatically pass transactions started by Sequelize#transaction. You will need to pass transactions around manually if you disable this.

foreignKeys?: boolean

SQLite only. If set to false, foreign keys will not be enforced by SQLite.

Default

true
hooks?: Partial<SequelizeHooks>

Sets global permanent hooks.

host?: string

The host of the relational database.

Default

'localhost'
isolationLevel: IsolationLevel

Set the default transaction isolation level. See Sequelize.Transaction.ISOLATION_LEVELS for possible options.

Default

'REPEATABLE_READ'
keepDefaultTimezone?: boolean

A flag that defines if the default timezone is used to convert dates from the database.

Default

false
logQueryParameters?: boolean

Set to true to show bind parameters in log.

Default

false
logging?: boolean | ((sql, timing?) => void)

A function that gets executed while running the query to log the sql.

Type declaration

    • (sql, timing?): void
    • Parameters

      • sql: string
      • Optional timing: number

      Returns void

minifyAliases?: boolean

Set to true to automatically minify aliases generated by sequelize. Mostly useful to circumvent the POSTGRES alias limit of 64 characters.

Default

false
models?: ModelStatic[]

A 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:

Example

import { User } from './models/user.js';

new Sequelize({
models: [User],
});

Example

new Sequelize({
models: await importModels(__dirname + '/*.model.ts'),
});
native?: boolean

A flag that defines if native library shall be used or not. Currently only has an effect for postgres

Default

false
noTypeValidation: boolean

Disable built in type validators on insert and update, e.g. don't validate that arguments passed to integer fields are integer-like.

Default

false
omitNull?: boolean

A flag that defines if null values should be passed to SQL queries or not.

Default

false
password?: string

The password which is used to authenticate against the database.

Connection pool options

port?: string | number

The port of the relational database.

protocol?: string

The protocol of the relational database.

Default

'tcp'
query?: QueryOptions

Default options for sequelize.query

quoteIdentifiers?: boolean

Set to false to make table names and attributes case-insensitive on Postgres and skip double quoting of them.

Default

true
retry?: Options
schema?: string

If defined the connection will use the provided schema instead of the default ("public").

Default options for sequelize.set

ssl?: boolean

A flag that defines if is used SSL.

standardConformingStrings?: boolean

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!

Default

true
storage?: string

Only used by sqlite.

Default

':memory:'

Default options for sequelize.sync

timezone: string

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 supported by Intl.Locale (e.g. 'America/Los_Angeles'); this is useful to capture daylight savings time changes.

Default

'+00:00'
transactionType: TransactionType

Set the default transaction type. See Sequelize.Transaction.TYPES for possible options. Sqlite only.

Default

'DEFERRED'
username?: string

The username which is used to authenticate against the database.

Generated using TypeDoc