Skip to content

Commit e3cc813

Browse files
committed
Recreate postgres users in dev:init
When running `yarn dev:init`, drop any existing postgres user accounts before (re-)creating them.
1 parent 2978993 commit e3cc813

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
audience: developers
2+
level: silent
3+
---
4+
When running `yarn dev:init`, delete any existing accounts before creating them.

infrastructure/tooling/src/dev/postgres.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ const postgresResources = async ({ userConfig, answer, configTmpl }) => {
131131
username, password,
132132
dbname: dbName,
133133
});
134-
console.log(`Creating DB user ${username}`);
134+
console.log(`(Re)creating DB user ${username}`);
135135
// this is all user-generated content without `'`, so including it literally
136136
// in the SQL is OK
137+
await client.query(`drop user if exists ${username}`);
137138
await client.query(`create user ${username} password '${password}'`);
138139
userConfig[serviceName].read_db_url = url;
139140
userConfig[serviceName].write_db_url = url;

0 commit comments

Comments
 (0)