Skip to content

Commit

Permalink
feat: added automatic schema creation to sequelize.sync() and model.c…
Browse files Browse the repository at this point in the history
…reate()
  • Loading branch information
yumin2002 committed Apr 26, 2024
1 parent c8729db commit 243decb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/src/sequelize.js
Expand Up @@ -456,6 +456,13 @@ Use Sequelize#query if you wish to use replacements.`);
);
}

if (options.schema) {
const schemas = await this.queryInterface.listSchemas();
if (!schemas.includes(options.schema)) {
await this.queryInterface.createSchema(options.schema);
}
}

if (options.hooks) {
await this.hooks.runAsync('beforeBulkSync', options);
}
Expand Down

0 comments on commit 243decb

Please sign in to comment.