diff --git a/packages/core/src/infrastructure/database/scripts/setup.ts b/packages/core/src/infrastructure/database/scripts/setup.ts index 1229f105..d20ef9f4 100644 --- a/packages/core/src/infrastructure/database/scripts/setup.ts +++ b/packages/core/src/infrastructure/database/scripts/setup.ts @@ -14,8 +14,20 @@ const __dirname = path.dirname(__filename); // This is the full path to the `setup.sql` file. const pathToInitFile = path.join(__dirname, 'setup.sql'); -exec(`psql -f ${pathToInitFile}`, (_, stdout, stderror) => { - if (stderror) { - throw new Error(stderror); +exec( + `psql -U postgres -d postgres -f ${pathToInitFile}`, + (error, stdout, stderr) => { + if (stdout) { + console.log(stdout); + } + + if (stderr) { + // Log but don't throw for notices/warnings. + console.warn(stderr); + } + + if (error) { + throw new Error(`psql exited with error: ${error}`); + } } -}); +);