Skip to content

Commit

Permalink
docs(postgresql): Add more elaborate example
Browse files Browse the repository at this point in the history
  • Loading branch information
srid authored Jun 4, 2024
1 parent 3412c51 commit 46281eb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@

- Run postgres server initialised with a sample database and graphically interact with it using [pgweb](https://github.com/sosedoff/pgweb): <https://github.com/juspay/services-flake/tree/main/example/simple>

## Guide

{#init}
### Creating users & tables

Assuming your initial schema is defined in `./scripts/db.sql`:

```nix
# In `perSystem.process-compose.<name>`
{
services.postgres."pg1" = {
enable = true;
initialScript.before = ''
CREATE USER myuser WITH password 'mypasswd';
'';
initialDatabases = [
{
name = "mydb";
schemas = [ ./scripts/db.sql ];
}
];
};
}
```

## Gotchas

{#socket-path}
Expand Down

0 comments on commit 46281eb

Please sign in to comment.