Sequelize options that are not persisted in the Sequelize instance.

interface EphemeralSequelizeOptions<Dialect> {
    databaseVersion?: string;
    dialect: "mysql" | "postgres" | "sqlite3" | "mariadb" | "mssql" | "db2" | "snowflake" | "ibmi" | Class<Dialect>;
    hooks?: Partial<SequelizeHooks<Dialect>>;
    models?: ModelStatic[];
    pool?: PoolOptions<Dialect>;
    url?: string;
}

Type Parameters

Hierarchy (view full)

Properties

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.

dialect: "mysql" | "postgres" | "sqlite3" | "mariadb" | "mssql" | "db2" | "snowflake" | "ibmi" | Class<Dialect>

The dialect of the database you are connecting to. Either the name of the dialect, or a dialect class.

Sets global permanent hooks.

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'),
});

Connection pool options

url?: string

The connection URL. If other connection options are set, they will override the values set in this URL.