@rehearsal-db/core 0.1.0-beta.5 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -1
- package/COMPATIBILITY.md +5 -0
- package/README.md +112 -377
- package/SECURITY.md +2 -1
- package/docs/adapters.md +5 -0
- package/docs/baselines.md +81 -22
- package/docs/commands.md +105 -75
- package/docs/configuration.md +109 -8
- package/docs/getting-started.md +88 -227
- package/docs/glossary.md +7 -8
- package/docs/releasing.md +10 -1
- package/docs/roadmap.md +39 -0
- package/docs/security-model.md +5 -1
- package/docs/troubleshooting.md +69 -1
- package/docs/tutorial.md +70 -59
- package/package.json +4 -2
- package/scripts/lib/environment/local_supabase.mjs +8 -8
- package/scripts/lib/rehearsal/baseline_artifact.mjs +32 -3
- package/scripts/lib/rehearsal/cleanup.mjs +381 -0
- package/scripts/lib/rehearsal/configuration.d.mts +24 -3
- package/scripts/lib/rehearsal/configuration.mjs +337 -59
- package/scripts/lib/rehearsal/diagnostics.mjs +4 -2
- package/scripts/lib/rehearsal/plan.mjs +89 -14
- package/scripts/lib/rehearsal/runtime_restore.mjs +6 -2
- package/scripts/lib/rehearsal/setup.mjs +60 -28
- package/scripts/lib/runtime/postgresql_runtime.mjs +772 -0
- package/scripts/lib/runtime/runtime_target.mjs +41 -0
- package/scripts/lib/runtime/supabase_runtime.mjs +792 -0
- package/scripts/operations/database/manage_rehearsal_database.mjs +6 -785
- package/scripts/operations/rehearsal/rehearsal_cli.mjs +330 -31
package/docs/baselines.md
CHANGED
|
@@ -1,33 +1,92 @@
|
|
|
1
1
|
# Baselines
|
|
2
2
|
|
|
3
|
-
A baseline is
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A baseline is the locked starting point for every rehearsal. It combines safe rows with
|
|
4
|
+
the exact historical migrations that created their schema. Resetting the runtime always
|
|
5
|
+
returns to this point.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Required inputs
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
and made read-only. A complete manifest is verified before an atomic `current` symlink
|
|
11
|
-
selects the generation. An interrupted build cannot replace the active baseline.
|
|
9
|
+
### Records
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Records use NDJSON: one complete JSON object per line. Each object names a table and one
|
|
12
|
+
safe row.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
```json
|
|
15
|
+
{ "table": "widgets", "row": { "id": 1, "name": "Synthetic Widget" } }
|
|
16
|
+
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
Use synthetic or reviewed sanitized values. A `.json` array is not NDJSON and will be
|
|
19
|
+
rejected.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
schema, streams sanitized rows, restores checksummed local Storage assets, reapplies
|
|
23
|
-
normal enforcement, and verifies counts and foreign keys. A failure removes trust and
|
|
24
|
-
cannot leave a successful receipt.
|
|
21
|
+
### Migration ledger
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
The ledger is a JSON array in migration order:
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
```json
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"version": "20260101000000",
|
|
29
|
+
"name": "create_widgets",
|
|
30
|
+
"statements": [
|
|
31
|
+
"create table public.widgets (id bigint primary key, name text not null)"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
```
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
Each entry must match the version, name, order, and SQL represented by the historical
|
|
38
|
+
migration. Equivalent-looking SQL is not enough. Generate this evidence with reviewed
|
|
39
|
+
project tooling for a real migration history; do not reconstruct a large ledger by hand.
|
|
40
|
+
|
|
41
|
+
### Sanitization policy
|
|
42
|
+
|
|
43
|
+
The policy records the approved treatment of every included table and column. The guide
|
|
44
|
+
can create a shape-only draft from the records and walk you through its review. A draft
|
|
45
|
+
with undecided fields cannot become a baseline. See [Sanitization](sanitization.md).
|
|
46
|
+
|
|
47
|
+
### Storage manifest (optional)
|
|
48
|
+
|
|
49
|
+
Supabase projects may include a bounded set of approved local Storage files. Plain
|
|
50
|
+
PostgreSQL projects do not support Supabase Storage. Every file is checksum-verified and
|
|
51
|
+
must remain inside the project.
|
|
52
|
+
|
|
53
|
+
## Create a baseline
|
|
54
|
+
|
|
55
|
+
The guided action is recommended:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx rehearsal
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For automation, use explicit safe local paths:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx rehearsal baseline create \
|
|
65
|
+
--records=rehearsal/sanitized-data.ndjson \
|
|
66
|
+
--ledger=rehearsal/migration-ledger.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Add `--assets=rehearsal/assets.json` only when using approved Supabase Storage files.
|
|
70
|
+
Rehearsal validates everything and shows counts before activation. It never extracts data.
|
|
71
|
+
|
|
72
|
+
## Why historical migrations are locked
|
|
73
|
+
|
|
74
|
+
The baseline records the exact ordered historical migration files. If a file keeps the
|
|
75
|
+
same timestamp but its bytes change, Rehearsal reports modified history instead of
|
|
76
|
+
treating it as a new candidate. New migrations must form an ordered suffix after the
|
|
77
|
+
baseline cutoff.
|
|
78
|
+
|
|
79
|
+
## What reset does
|
|
80
|
+
|
|
81
|
+
`reset` removes only the exactly labeled local runtime, rebuilds the represented schema,
|
|
82
|
+
loads the safe rows, restores approved Storage files when present, and verifies counts and
|
|
83
|
+
relationships. A failed restore cannot produce a successful receipt.
|
|
84
|
+
|
|
85
|
+
The baseline itself never changes during normal use. Runtime edits persist until you
|
|
86
|
+
reset or discard that runtime.
|
|
87
|
+
|
|
88
|
+
## Storage and privacy
|
|
89
|
+
|
|
90
|
+
Baseline files can still be sensitive after sanitization. Rehearsal stores them under the
|
|
91
|
+
ignored `.rehearsal/` directory with checksums and read-only files. Keep them off shared
|
|
92
|
+
drives, use encrypted disks, retain them only as long as needed, and never commit them.
|
package/docs/commands.md
CHANGED
|
@@ -1,77 +1,107 @@
|
|
|
1
1
|
# CLI commands
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
| `rehearsal
|
|
24
|
-
| `rehearsal
|
|
25
|
-
|
|
|
26
|
-
| `rehearsal
|
|
27
|
-
| `rehearsal
|
|
28
|
-
| `rehearsal
|
|
29
|
-
|
|
|
30
|
-
| `rehearsal
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
the
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
3
|
+
Run commands from the project directory containing `rehearsal.config.mjs`. The examples
|
|
4
|
+
use `npx`, so a global install is not required.
|
|
5
|
+
|
|
6
|
+
## Guided mode
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx rehearsal
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The guide reads the current project state and recommends the next useful action. It stays
|
|
13
|
+
open after each action. Press `Ctrl+Z` at a prompt to exit the entire session.
|
|
14
|
+
|
|
15
|
+
Use `npx rehearsal guide` for the same screen or add `--plain` to use numbered menus
|
|
16
|
+
without decorative terminal styling. When input or output is not an interactive terminal,
|
|
17
|
+
bare `npx rehearsal` prints help instead of waiting for input.
|
|
18
|
+
|
|
19
|
+
## Setup and baseline
|
|
20
|
+
|
|
21
|
+
| Command | What it does |
|
|
22
|
+
| ----------------------------------------------------------------- | ------------------------------------------------------ |
|
|
23
|
+
| `npx rehearsal setup --target=supabase` | Preview Supabase setup files. |
|
|
24
|
+
| `npx rehearsal setup --target=postgresql` | Preview PostgreSQL setup files. |
|
|
25
|
+
| Add `--write` to either setup command | Create the previewed files without overwriting. |
|
|
26
|
+
| `npx rehearsal init` | Preview only `rehearsal.config.mjs`. |
|
|
27
|
+
| `npx rehearsal init --write` | Create only `rehearsal.config.mjs`. |
|
|
28
|
+
| `npx rehearsal baseline prepare --records=<path> --ledger=<path>` | Preview a sanitization-policy draft. |
|
|
29
|
+
| Add `--write` to `baseline prepare` | Write the draft for human review. |
|
|
30
|
+
| `npx rehearsal baseline create --records=<path> --ledger=<path>` | Create and activate a baseline from safe local inputs. |
|
|
31
|
+
|
|
32
|
+
Add `--assets=<manifest.json>` to `baseline create` only for approved local Supabase
|
|
33
|
+
Storage files. Baseline commands never extract data or connect to another database.
|
|
34
|
+
|
|
35
|
+
## Check and inspect
|
|
36
|
+
|
|
37
|
+
| Command | What it does |
|
|
38
|
+
| ---------------------------------- | ----------------------------------------------------- |
|
|
39
|
+
| `npx rehearsal doctor` | Check dependencies, inputs, and safety rules. |
|
|
40
|
+
| `npx rehearsal support` | Print a privacy-safe report for a support request. |
|
|
41
|
+
| `npx rehearsal explain` | Show the exact plan without changing anything. |
|
|
42
|
+
| `npx rehearsal run --dry-run` | Show the same non-mutating plan. |
|
|
43
|
+
| `npx rehearsal candidates` | List pending migrations and their approval digest. |
|
|
44
|
+
| `npx rehearsal inspect baseline` | Show baseline metadata without row values. |
|
|
45
|
+
| `npx rehearsal inspect migrations` | Classify every historical and candidate migration. |
|
|
46
|
+
| `npx rehearsal status` | Report baseline, candidates, and local runtime state. |
|
|
47
|
+
|
|
48
|
+
State-reporting commands accept `--json` for scripts. Scripts should use the JSON fields
|
|
49
|
+
and process exit code, not parse human-facing text.
|
|
50
|
+
|
|
51
|
+
## Run and manage the local database
|
|
52
|
+
|
|
53
|
+
| Command | What it does |
|
|
54
|
+
| ----------------------------------------------------- | ------------------------------------------------------------------- |
|
|
55
|
+
| `npx rehearsal run --confirm-candidates=<sha256>` | Reset, apply the exact candidates, verify, and run the app proof. |
|
|
56
|
+
| `npx rehearsal migrate --confirm-candidates=<sha256>` | Apply the exact candidates without resetting existing runtime data. |
|
|
57
|
+
| `npx rehearsal start` | Start an existing verified runtime. |
|
|
58
|
+
| `npx rehearsal verify` | Verify the current runtime and receipt. |
|
|
59
|
+
| `npx rehearsal reset` | Discard runtime edits and restore the baseline. |
|
|
60
|
+
| `npx rehearsal stop` | Stop the runtime but keep its local state. |
|
|
61
|
+
| `npx rehearsal discard` | Remove this project's disposable runtime and volume. |
|
|
62
|
+
| `npx rehearsal cleanup` | Preview conservative cleanup without removing anything. |
|
|
63
|
+
|
|
64
|
+
In a terminal, the guide displays candidate filenames and asks for confirmation. In a
|
|
65
|
+
script, copy the digest from `candidates` into `--confirm-candidates`. Adding, removing,
|
|
66
|
+
reordering, or editing a migration changes that digest.
|
|
67
|
+
|
|
68
|
+
## Clean up disk space
|
|
69
|
+
|
|
70
|
+
Start with a preview:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx rehearsal cleanup
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
By default, cleanup selects only old baseline generations beyond the retention setting
|
|
77
|
+
in `rehearsal.config.mjs`. Add options to broaden the preview:
|
|
78
|
+
|
|
79
|
+
| Command option | Additional resources considered |
|
|
80
|
+
| ------------------- | ---------------------------------------------------------------------- |
|
|
81
|
+
| `--include-runtime` | This project's disposable runtime and its database volumes. |
|
|
82
|
+
| `--include-images` | Older unused Supabase images; the newest image for each service stays. |
|
|
83
|
+
| `--write` | Apply the exact freshly verified preview. |
|
|
84
|
+
| `--confirm-cleanup` | Full cleanup digest printed by the preview; required with `--write`. |
|
|
85
|
+
|
|
86
|
+
Image cleanup never removes an image used by any running or stopped container and never
|
|
87
|
+
runs a global Docker prune. Images may be shared by projects and can be downloaded again,
|
|
88
|
+
so they remain excluded unless you explicitly add `--include-images`. Database volumes
|
|
89
|
+
belonging to other projects are never included. This follows
|
|
90
|
+
[Docker's conservative pruning guidance](https://docs.docker.com/engine/manage-resources/pruning/).
|
|
91
|
+
|
|
92
|
+
## Common options
|
|
93
|
+
|
|
94
|
+
| Option | Meaning |
|
|
95
|
+
| ------------------------------- | ---------------------------------------------------------------- |
|
|
96
|
+
| `--json` | Return the versioned machine-readable result. |
|
|
97
|
+
| `--verbose` | Show more safe detail. |
|
|
98
|
+
| `--debug` | Show the most diagnostic detail; still review it before sharing. |
|
|
99
|
+
| `--plain` | Disable decorative interactive prompts. |
|
|
100
|
+
| `--config=<path>` | Use a specific config file inside the project. |
|
|
101
|
+
| `--target=supabase\|postgresql` | Choose the setup target. |
|
|
102
|
+
| `--include-runtime` | Include this project's runtime in a cleanup preview. |
|
|
103
|
+
| `--include-images` | Include older unused Supabase images in a cleanup preview. |
|
|
104
|
+
| `--confirm-cleanup=<digest>` | Confirm the exact cleanup set printed by the preview. |
|
|
105
|
+
| `--write` | Apply a setup, policy, or cleanup preview. |
|
|
106
|
+
|
|
107
|
+
Run `npx rehearsal --help` to print the command list available in your installed version.
|
package/docs/configuration.md
CHANGED
|
@@ -1,38 +1,79 @@
|
|
|
1
1
|
# Configuration reference
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Most users should let the guide create this file:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx rehearsal
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The first run uses your chosen database type and detects the project name, migration
|
|
10
|
+
folder, package-manager commands, and free local ports. After you approve the setup
|
|
11
|
+
preview, it creates a commented `rehearsal.config.mjs` with those values filled in.
|
|
12
|
+
Installation itself does not use a `postinstall` script or silently modify the project.
|
|
13
|
+
|
|
14
|
+
Review lines marked `CHECK`, especially the application proof command. Optional settings
|
|
15
|
+
are present as commented examples, and secrets never belong in this file. Rehearsal will
|
|
16
|
+
not overwrite an existing config.
|
|
17
|
+
|
|
18
|
+
Use this page when changing the generated file. The schema is strict: misspelled fields,
|
|
19
|
+
unknown fields, and unsupported versions are errors. The `.mjs` extension works in both
|
|
20
|
+
CommonJS and ESM projects.
|
|
7
21
|
|
|
8
22
|
```ts
|
|
23
|
+
// @ts-check
|
|
9
24
|
import { defineRehearsalConfig } from "@rehearsal-db/core";
|
|
10
25
|
|
|
11
26
|
export default defineRehearsalConfig({
|
|
27
|
+
// Configuration format. Rehearsal will explain if an upgrade is ever needed.
|
|
12
28
|
schemaVersion: 1,
|
|
29
|
+
// Stable local name used in Rehearsal labels and reports.
|
|
13
30
|
project: { name: "example-app" },
|
|
31
|
+
|
|
32
|
+
// Project files Rehearsal reads. Every path stays inside this repository.
|
|
14
33
|
supabase: {
|
|
15
34
|
workdir: ".",
|
|
16
35
|
migrationDirectory: "supabase/migrations",
|
|
17
36
|
rehearsalConfig: "infrastructure/rehearsal/supabase/config.toml",
|
|
18
37
|
runtimeWorkdir: ".rehearsal/runtime",
|
|
38
|
+
|
|
39
|
+
// Optional; configure both keys together.
|
|
40
|
+
// serviceEnvironmentFile: ".env.rehearsal-service.local",
|
|
41
|
+
// serviceEnvironmentVariables: ["LOCAL_IDP_CLIENT_ID", "LOCAL_IDP_SECRET"],
|
|
19
42
|
},
|
|
20
43
|
baseline: {
|
|
21
44
|
artifactDirectory: ".rehearsal",
|
|
22
45
|
sanitizationPolicy: "infrastructure/rehearsal/sanitization-policy.json",
|
|
23
46
|
},
|
|
47
|
+
containerRuntime: {
|
|
48
|
+
autoStartColima: true,
|
|
49
|
+
},
|
|
50
|
+
cleanup: {
|
|
51
|
+
retainBaselineGenerations: 2,
|
|
52
|
+
},
|
|
24
53
|
application: {
|
|
54
|
+
// CHECK: replace these when the detected package scripts are not correct.
|
|
25
55
|
startCommand: "npm run dev:rehearsal",
|
|
26
56
|
proofCommand: "npm run test:rehearsal",
|
|
57
|
+
environmentFile: ".rehearsal/runtime.env",
|
|
27
58
|
},
|
|
28
59
|
runtime: {
|
|
60
|
+
target: "supabase",
|
|
29
61
|
applicationUrl: "http://localhost:5175",
|
|
30
62
|
projectId: "example-app-rehearsal",
|
|
31
63
|
apiPort: 58321,
|
|
32
64
|
databasePort: 58322,
|
|
33
65
|
studioPort: 58323,
|
|
34
66
|
},
|
|
35
|
-
safety: {
|
|
67
|
+
safety: {
|
|
68
|
+
allowedHosts: ["127.0.0.1", "::1", "localhost"],
|
|
69
|
+
blockedEnvironmentVariables: [
|
|
70
|
+
"SUPABASE_ACCESS_TOKEN",
|
|
71
|
+
"SUPABASE_DB_PASSWORD",
|
|
72
|
+
"SUPABASE_PROJECT_ID",
|
|
73
|
+
],
|
|
74
|
+
hostedAccess: "disabled",
|
|
75
|
+
outboundNetwork: "deny",
|
|
76
|
+
},
|
|
36
77
|
});
|
|
37
78
|
```
|
|
38
79
|
|
|
@@ -42,6 +83,29 @@ All paths resolve inside the consuming project. The artifact directory must be n
|
|
|
42
83
|
`.rehearsal`; this is an intentional deletion guard. `runtimeWorkdir` must be its
|
|
43
84
|
`runtime` child, and the generated application environment file must remain inside it.
|
|
44
85
|
|
|
86
|
+
Rehearsal never overwrites this config. To start over, move the existing file somewhere
|
|
87
|
+
safe, run setup again, and compare the two files before deleting either one.
|
|
88
|
+
|
|
89
|
+
## Container runtime and cleanup
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
containerRuntime: {
|
|
93
|
+
autoStartColima: true,
|
|
94
|
+
},
|
|
95
|
+
cleanup: {
|
|
96
|
+
retainBaselineGenerations: 2,
|
|
97
|
+
},
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Rehearsal uses whichever Docker-compatible engine already answers `docker info`. If none
|
|
101
|
+
is running and `autoStartColima` is `true`, Rehearsal may run `colima start`. It respects
|
|
102
|
+
the user's Colima CPU, memory, and disk settings and never changes them. Set the field to
|
|
103
|
+
`false` when you prefer to start Docker or Colima yourself.
|
|
104
|
+
|
|
105
|
+
`retainBaselineGenerations` controls how many immutable baseline generations survive
|
|
106
|
+
`rehearsal cleanup`; it must be at least 1. Runtime deletion and shared-image inspection
|
|
107
|
+
are command choices, not automatic retention settings. See [CLI commands](commands.md).
|
|
108
|
+
|
|
45
109
|
## Supabase service environment
|
|
46
110
|
|
|
47
111
|
Some local identity providers need a client ID and secret. Configure both fields or
|
|
@@ -58,9 +122,12 @@ terminate at local Auth. They do not grant hosted database access.
|
|
|
58
122
|
|
|
59
123
|
## Safety fields
|
|
60
124
|
|
|
61
|
-
Version 1 accepts loopback
|
|
62
|
-
`outboundNetwork` can only be `deny`.
|
|
63
|
-
from child processes.
|
|
125
|
+
Version 1 accepts loopback runtime URLs only. `hostedAccess` can only be `disabled`, and
|
|
126
|
+
`outboundNetwork` can only be `deny`. Common hosted Supabase and PostgreSQL credentials
|
|
127
|
+
are quarantined from child processes. These fields are fail-closed configuration rules,
|
|
128
|
+
not a host firewall: trusted project proof commands and runtime adapters remain ordinary
|
|
129
|
+
local code and must be reviewed. There is no force flag to weaken the configuration
|
|
130
|
+
rules.
|
|
64
131
|
|
|
65
132
|
## Ports and project identity
|
|
66
133
|
|
|
@@ -68,6 +135,40 @@ Use unique, non-privileged ports that do not overlap. `projectId` accepts lowerc
|
|
|
68
135
|
letters, numbers, and hyphens. It labels the local Docker resources so cleanup targets
|
|
69
136
|
only this project.
|
|
70
137
|
|
|
138
|
+
## Database runtime
|
|
139
|
+
|
|
140
|
+
`runtime.target` selects the isolated database driver. It is optional in existing
|
|
141
|
+
configurations and currently defaults to `"supabase"`, so upgrading does not change an
|
|
142
|
+
existing project's behavior. Unknown targets are rejected before any runtime action.
|
|
143
|
+
|
|
144
|
+
For ordinary PostgreSQL, use `postgresql` instead of `supabase`:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
postgresql: {
|
|
148
|
+
migrationDirectory: "database/migrations",
|
|
149
|
+
runtimeWorkdir: ".rehearsal/runtime",
|
|
150
|
+
image: "postgres:17-alpine",
|
|
151
|
+
database: "postgres",
|
|
152
|
+
user: "postgres",
|
|
153
|
+
},
|
|
154
|
+
runtime: {
|
|
155
|
+
target: "postgresql",
|
|
156
|
+
applicationUrl: "http://localhost:5175",
|
|
157
|
+
projectId: "example-app-rehearsal",
|
|
158
|
+
databasePort: 58322,
|
|
159
|
+
},
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The image must be an official versioned Alpine PostgreSQL image and must already exist
|
|
163
|
+
locally. Rehearsal runs it with `--pull=never`, publishes it only on `127.0.0.1`, and
|
|
164
|
+
creates a fresh random runtime password in owner-readable ignored files. It manages only
|
|
165
|
+
the exactly named container and volume carrying the matching project label.
|
|
166
|
+
Plain PostgreSQL does not restore Supabase Storage assets or synthesize Supabase Auth
|
|
167
|
+
users.
|
|
168
|
+
|
|
169
|
+
Project-owned runtime adapters remain the place for application-specific setup and
|
|
170
|
+
checks; they do not replace the database driver.
|
|
171
|
+
|
|
71
172
|
## Application proof
|
|
72
173
|
|
|
73
174
|
`proofCommand` is mandatory and project-owned. It should test restored relationships,
|