Initialize the database connection, connects models to Sequelize and syncs them
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
models | array | An array that contains Sequelize models | |||||||||||||
associations | object | <optional> | An object mapping associations between models Properties
| ||||||||||||
sync | boolean | <optional> | Sync models to database on initialize |
- Since
- 2.2.0
- Copyright
- MIT
- Source
Returns:
- Type:
- Promise.<void>
Example
const {Runtime, db} = require('@neobeach/core');
const User = require('./models/User');
Runtime(async () => {
// Include your own code here
await db.init([User]);
});