Skip to content

Commit 32a0248

Browse files
committed
adapt docs
1 parent af55238 commit 32a0248

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

docs/docs/cli.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
usage: pum [-h] [-c CONFIG_FILE] -p PG_CONNECTION [-d DIR] [-v] [-q] [--version] {info,install,upgrade,role,check,dump,restore,baseline,uninstall} ...
1+
usage: pum [-h] [-c CONFIG_FILE] -p PG_CONNECTION [-d DIR] [-v] [-q] [--version] {info,install,upgrade,role,check,dump,restore,baseline,uninstall,app} ...
22
### options:
33
- `-h, --help`: show this help message and exit
44
- `-c CONFIG_FILE, --config_file CONFIG_FILE`: set the config file. Default: .pum.yaml
@@ -9,7 +9,7 @@ usage: pum [-h] [-c CONFIG_FILE] -p PG_CONNECTION [-d DIR] [-v] [-q] [--version]
99
- `--version`: Show program's version number and exit.
1010
### commands:
1111
valid pum commands
12-
{info,install,upgrade,role,check,dump,restore,baseline,uninstall}
12+
{info,install,upgrade,role,check,dump,restore,baseline,uninstall,app}
1313
- `info`: show info about schema migrations history.
1414
- `install`: Installs the module.
1515
- `upgrade`: Upgrade the database.
@@ -19,3 +19,4 @@ valid pum commands
1919
- `restore`: restore a Postgres database from a dump file
2020
- `baseline`: Create upgrade information table and set baseline
2121
- `uninstall`: Uninstall the module by executing uninstall hooks
22+
- `app`: Manage application handlers (create, drop, recreate)

docs/docs/cli/app.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
usage: pum app [-h] [-p PARAMETER PARAMETER] {create,drop,recreate}
2+
### positional arguments:
3+
- `{create,drop,recreate}`: Action to perform: create (run create_app handlers), drop (run drop_app handlers), recreate (run drop then create)
4+
### options:
5+
- `-h, --help`: show this help message and exit
6+
- `-p PARAMETER PARAMETER, --parameter PARAMETER PARAMETER`: Assign variable for running SQL handlers. Format is name value.

docs/docs/parameters.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Each parameter accepts:
1212
- **type** *(optional, default: `text`)*: One of `boolean`, `integer`, `text`, `decimal`, `path`.
1313
- **default** *(optional)*: A default value used for validation.
1414
- **description** *(optional)*: A human-readable description.
15+
- **app_only** *(optional, default: `false`)*: If `true`, the parameter can be changed freely when recreating the app. Standard parameters (`app_only: false`) must keep the same value across the entire module lifecycle (install, upgrade, create-app).
1516

1617
```yaml
1718
parameters:
@@ -27,8 +28,27 @@ parameters:
2728
- name: my_flag
2829
type: boolean
2930
default: true
31+
32+
- name: view_comment
33+
type: text
34+
default: my comment
35+
description: Comment used when creating application views.
36+
app_only: true
3037
```
3138
39+
### Standard vs. app-only parameters
40+
41+
PUM stores the parameter values used during each migration in the `pum_migrations` table.
42+
On every subsequent **upgrade**, **create app**, or **recreate app** call, PUM compares the
43+
provided parameter values against the stored ones:
44+
45+
- **Standard parameters** (`app_only: false`, the default) must remain unchanged. If a
46+
different value is provided, PUM raises an error. This protects structural values
47+
(e.g. an SRID) that would cause data inconsistencies if changed after installation.
48+
- **App-only parameters** (`app_only: true`) are allowed to change between calls. Use
49+
this for values that only affect application-level objects such as views or comments,
50+
which are dropped and recreated anyway.
51+
3252
## Passing values from the CLI
3353

3454
Parameter values are provided at runtime via the `-p` / `--parameter` flag, which takes a name and a value:

pum/config_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class ParameterDefinitionModel(PumCustomBaseModel):
2121
description: Optional description of the parameter.
2222
app_only: If True, the parameter can be changed when recreating the app.
2323
Standard parameters (app_only=False) must remain the same across
24-
the whole application lifecycle.
24+
the whole module lifecycle.
2525
"""
2626

2727
name: str
2828
type: ParameterType = Field(default=ParameterType.TEXT, description="Type of the parameter")
2929
default: Any | None = None
3030
description: str | None = None
3131
app_only: bool = Field(
32-
default=False, description="If True, the parameter can be changed when recreating the app."
32+
default=False, description="If True, the parameter can be adapted when recreating the app."
3333
)
3434

3535
@model_validator(mode="before")

0 commit comments

Comments
 (0)