Database

Note: This won't do anything for you if you're not using a StorageProvider for your client that uses Sequelize

Holds the Sequelize connection to whichever database backend is chosen via the Client StorageProvider. As long as you wait until clientReady you can safely use Database.instance to get the Database instance and access the Sequelize connection via Database#db

This will allow you to define and access your own Sequelize Models without having to create another database connection. This is especially important when using SQLiteProvider as SQLite does not like having multiple connections

Constructor

new Database()

Source:

Properties

.db: Sequelize

The Sequelize connection to the database specified by your chosen storage provider

Type:
Sequelize
Source:

Methods

(static) .instance(url?: string)Database

As long as a Sequelize-using storage provider is being used, this will return the Database instance holding the Sequelize connection to the database

Parameters:
Name Type Attributes Description
url
string
<optional>

The database connection url

Source:
Returns:
Database

.init() → Promise<void>

Authenticate the connection to the database

Source:
Returns:
Promise<void>