Skip to content

Commit 7b521ba

Browse files
authored
Sam/docs add tests update (#1556)
* docs: schema.sql per maj version update * docs: update command for flake checks
1 parent b3010c8 commit 7b521ba

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

migrations/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ Then, populate the migration at `./db/migrations/xxxxxxxxx_<some_message>` and m
120120
```shell
121121
docker-compose run --rm dbmate up
122122
```
123+
### Updating schema.sql for each major version
123124

125+
After making changes to migrations, you should update the schema.sql files for each major version of PostgreSQL:
126+
127+
```shell
128+
# First, stop any running PostgreSQL servers
129+
# Then from the root of supabase/postgres run:
130+
nix run .#dbmate-tool -- --version all
131+
```
132+
133+
This will create a schema.sql file for each major version of PostgreSQL. Commit these changes to your repository and push to your branch. The test.yml workflow will verify these changes against the test matrix.
124134
## Testing
125135

126136
Migrations are tested in CI to ensure they do not raise an exception against previously released `supabase/postgres` docker images. The full version matrix is at [test.yml](./.github/workflows/test.yml) in the `supabase-version` variable.

nix/docs/adding-tests.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ and [prime.sql](../tests/prime.sql) (extensions may be enabled in either place.)
1111
## pg\_regress tests
1212

1313
pg\_regress tests are in [tests/sql](./../tests/sql/) with output in [tests/expected](./../tests/expected/).
14-
To create a new test, create a new SQL file in [tests/sql](./../tests/sql/) and then run:
14+
To create a new test, create a new SQL file in [tests/sql](./../tests/sql/)
15+
16+
Next, for each current major version of postgres, we run a "flake check" build one at a time.
17+
18+
Examples:
1519

1620
```
17-
nix flake check -L
21+
nix build .#checks.aarch64-darwin.psql_15 -L
22+
nix build .#checks.aarch64-darwin.psql_17 -L
23+
nix build .#checks.aarch64-darwin.psql_orioledb-17 -L
1824
```
1925

26+
(Note that the evaluation and nix build of the postgres packages "bundle" of each major version must succeed here, even though we run one version at a time. If you made changes to postgres or extensions, or wrappers those may rebuild here when you run this. Otherwise they will usually download the prebuilt version from the supabase nix binary cache)
27+
2028
Next, review the logs to identify where the test output was written
2129

2230
```

0 commit comments

Comments
 (0)