Skip to content

Commit

Permalink
Rename appuser -> dbuser in documentation (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored Jun 12, 2024
2 parents d41358a + d1771bb commit 07e5557
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,23 @@ unaffected by the iteration you've been applying to your development database
Create your database role (if desired), database and shadow database:

```bash
createuser --pwprompt appuser
createdb myapp --owner=appuser
createdb myapp_shadow --owner=appuser
createuser --pwprompt dbowner
createdb myapp --owner=dbowner
createdb myapp_shadow --owner=dbowner
```

> For an in depth-discussion on the different users and roles typically involved
> in database and migration management, please see issue
> [#215](https://github.com/graphile/migrate/issues/215).
Export your database URL, shadow database URL, and a "root" database URL which
should be a superuser account connection to any **other** database (most
PostgreSQL servers have a default database called `postgres` which is a good
choice for this).

```bash
export DATABASE_URL="postgres://appuser:password@localhost/myapp"
export SHADOW_DATABASE_URL="postgres://appuser:password@localhost/myapp_shadow"
export DATABASE_URL="postgres://dbowner:password@localhost/myapp"
export SHADOW_DATABASE_URL="postgres://dbowner:password@localhost/myapp_shadow"

export ROOT_DATABASE_URL="postgres://postgres:postgres@localhost/postgres"
```
Expand Down
18 changes: 9 additions & 9 deletions __tests__/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ describe("gmrc path", () => {
mockFs.restore();
mockFs({
[DEFAULT_GMRC_PATH]: `
{ "connectionString": "postgres://appuser:apppassword@host:5432/defaultdb" }
{ "connectionString": "postgres://dbowner:password@host:5432/defaultdb" }
`,
});
const settings = await getSettings();
expect(settings.connectionString).toEqual(
"postgres://appuser:apppassword@host:5432/defaultdb",
"postgres://dbowner:password@host:5432/defaultdb",
);
mockFs.restore();
});
Expand All @@ -334,15 +334,15 @@ describe("gmrc path", () => {
mockFs.restore();
mockFs({
[DEFAULT_GMRC_PATH]: `
{ "connectionString": "postgres://appuser:apppassword@host:5432/defaultdb" }
{ "connectionString": "postgres://dbowner:password@host:5432/defaultdb" }
`,
".other-gmrc": `
{ "connectionString": "postgres://appuser:apppassword@host:5432/otherdb" }
{ "connectionString": "postgres://dbowner:password@host:5432/otherdb" }
`,
});
const settings = await getSettings({ configFile: ".other-gmrc" });
expect(settings.connectionString).toEqual(
"postgres://appuser:apppassword@host:5432/otherdb",
"postgres://dbowner:password@host:5432/otherdb",
);
mockFs.restore();
});
Expand All @@ -362,12 +362,12 @@ describe("gmrc from JS", () => {
mockFs({
[DEFAULT_GMRCJS_PATH]: /* JavaScript */ `\
module.exports = {
connectionString: "postgres://appuser:apppassword@host:5432/gmrcjs_test",
connectionString: "postgres://dbowner:password@host:5432/gmrcjs_test",
};`,
});
const settings = await getSettings();
expect(settings.connectionString).toEqual(
"postgres://appuser:apppassword@host:5432/gmrcjs_test",
"postgres://dbowner:password@host:5432/gmrcjs_test",
);
mockFs.restore();
});
Expand All @@ -382,12 +382,12 @@ module.exports = {
mockFs({
[DEFAULT_GMRC_COMMONJS_PATH]: /* JavaScript */ `\
module.exports = {
connectionString: "postgres://appuser:apppassword@host:5432/gmrc_commonjs_test",
connectionString: "postgres://dbowner:password@host:5432/gmrc_commonjs_test",
};`,
});
const settings = await getSettings();
expect(settings.connectionString).toEqual(
"postgres://appuser:apppassword@host:5432/gmrc_commonjs_test",
"postgres://dbowner:password@host:5432/gmrc_commonjs_test",
);
mockFs.restore();
});
Expand Down
4 changes: 2 additions & 2 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export async function init(options: InitArgv = {}): Promise<void> {
*
* RECOMMENDATION: use \`DATABASE_URL\` envvar instead.
*/
// "connectionString": "postgres://appuser:apppassword@host:5432/appdb",
// "connectionString": "postgres://dbowner:password@host:5432/appdb",
/*
* shadowConnectionString: like connectionString, but this is used for the
* shadow database (which will be reset frequently).
*
* RECOMMENDATION: use \`SHADOW_DATABASE_URL\` envvar instead.
*/
// "shadowConnectionString": "postgres://appuser:apppassword@host:5432/appdb_shadow",
// "shadowConnectionString": "postgres://dbowner:password@host:5432/appdb_shadow",
/*
* rootConnectionString: like connectionString, but this is used for
Expand Down

0 comments on commit 07e5557

Please sign in to comment.