Browse Source

fix(server): Force db sync in CLI populate script

Michael Bromley 7 years ago
parent
commit
c7dbd91e06
1 changed files with 5 additions and 0 deletions
  1. 5 0
      server/cli/populate.ts

+ 5 - 0
server/cli/populate.ts

@@ -79,6 +79,11 @@ async function getApplicationRef(): Promise<INestApplication | undefined> {
 
     const config = index.config;
     config.silent = true;
+
+    // Force the sync mode on, so that all the tables are created
+    // on this initial run.
+    config.dbConnectionOptions.synchronize = true;
+
     const { bootstrap } = require('@vendure/core');
     console.log('Bootstrapping Vendure server...');
     const app = await bootstrap(config);