Create the given models in the current database. * * await db.sync({ drop: true });
(options: SyncOptions = {})
| 194 | * await db.sync({ drop: true }); |
| 195 | */ |
| 196 | async sync(options: SyncOptions = {}) { |
| 197 | if (options.drop) { |
| 198 | for (let i = this._models.length - 1; i >= 0; i--) { |
| 199 | await this._models[i].drop(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | if (options.truncate) { |
| 204 | for (let i = this._models.length - 1; i >= 0; i--) { |
| 205 | await this._models[i].truncate(); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | for (const model of this._models) { |
| 210 | await model.createTable(); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /** Associate all the required information for a model to connect to a database. |
| 215 | * |
no test coverage detected