mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-17 15:28:33 +03:00
docs(postgresql): Add more elaborate example
This commit is contained in:
parent
3412c51029
commit
8d64812420
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user