API Docs for:
Show:

Sequelize Class

Defined in: lib/sequelize.js:12
Module: Sequelize

Main class of the project.

Constructor

Sequelize

(
  • database
  • username
  • [password=null]
  • [options={}]
)

Defined in lib/sequelize.js:12

Parameters:

  • database String

    The name of the database.

  • username String

    The username which is used to authenticate against the database.

  • [password=null] String optional

    The password which is used to authenticate against the database.

  • [options={}] Object optional

    An object with options.

    • [dialect='mysql'] String optional

      The dialect of the relational database.

    • [host='localhost'] String optional

      The host of the relational database.

    • [port=3306] Integer optional

      The port of the relational database.

    • [protocol='tcp'] String optional

      The protocol of the relational database.

    • [define={}] Object optional

      Options, which shall be default for every model definition.

    • [query={}] Object optional

      I have absolutely no idea.

    • [sync={}] Object optional

      Options, which shall be default for every sync call.

    • [logging=console.log] Function optional

      A function that gets executed everytime Sequelize would log something.

    • [omitNull=false] Boolean optional

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

    • [queue=true] Boolean optional

      I have absolutely no idea.

    • [native=false] Boolean optional

      A flag that defines if native library shall be used or not.

    • [replication=false] Boolean optional

      I have absolutely no idea.

    • [pool={}] Object optional

      Something.

Example:

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

Item Index

Methods

getMigrator

(
  • [options={}]
  • [force=false]
)
Migrator

Returns an instance (singleton) of Migrator.

Parameters:

  • [options={}] Object optional

    Some options

  • [force=false] Boolean optional

    A flag that defines if the migrator should get instantiated or not.

Returns:

Migrator: An instance of Migrator.

getQueryInterface

() QueryInterface

Returns an instance of QueryInterface.

Returns:

QueryInterface: An instance (singleton) of QueryInterface.