Browse Source

fix(core): Prevent FK error when migrating with better-sqlite3 driver

Fixes #880
Michael Bromley 4 years ago
parent
commit
8bfa03d4ba
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/core/src/migrate.ts

+ 1 - 1
packages/core/src/migrate.ts

@@ -174,7 +174,7 @@ function createConnectionOptions(userConfig: Partial<VendureConfig>): Connection
  * See https://github.com/typeorm/typeorm/issues/2576#issuecomment-499506647
  */
 async function disableForeignKeysForSqLite<T>(connection: Connection, work: () => Promise<T>): Promise<T> {
-    const isSqLite = connection.options.type === 'sqlite';
+    const isSqLite = connection.options.type === 'sqlite' || connection.options.type === 'better-sqlite3';
     if (isSqLite) {
         await connection.query('PRAGMA foreign_keys=OFF');
     }