File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,11 @@ module.exports = class SchemaMigrationService extends Service {
1313 * @param model model object
1414 */
1515 dropModel ( model ) {
16- return model . sequelize . query ( 'SET FOREIGN_KEY_CHECKS = 0' ) . then ( ( ) => {
16+ const dialect = connection . dialect . connectionManager . dialectName
17+ return model . sequelize . query ( dialect === 'sqlite' ? 'PRAGMA foreign_keys = OFF' : 'SET FOREIGN_KEY_CHECKS = 0' ) . then ( ( ) => {
1718 return model . sync ( { force : true } )
1819 } ) . then ( ( ) => {
19- return model . sequelize . query ( 'SET FOREIGN_KEY_CHECKS = 1' )
20+ return model . sequelize . query ( dialect === 'sqlite' ? 'PRAGMA foreign_keys = ON' : 'SET FOREIGN_KEY_CHECKS = 1' )
2021 } ) . catch ( err => {
2122 return model . sync ( { force : true } )
2223 } )
You can’t perform that action at this time.
0 commit comments