Skip to content

Commit 7b38e2b

Browse files
committed
chore: more info on generation of schema.sql and running tests
1 parent e1aec56 commit 7b38e2b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

migrations/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,22 @@ After making changes to migrations, you should update the schema.sql files for e
130130
nix run .#dbmate-tool -- --version all
131131
```
132132

133-
This will create a schema.sql file for each major version of PostgreSQL and OrioleDB (the files are named like `schema-<ver>`, `schema-oriole-<ver>`). Commit these changes to your repository and push to your branch. The test.yml workflow will verify these changes against the test matrix.
133+
This will create automatically schema.sql file for each major version of PostgreSQL and OrioleDB (the files are named like `schema-<ver>`, `schema-oriole-<ver>`). Commit these changes to your repository and push to your branch. The workflow in `.github/workflows/test.yml` will re-run this command in CI, and perform a git diff to verify the idempotency of the migrations, and that the latest changes have been committed.
134+
134135
## Testing
135136

136-
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.
137+
In addition to ci test mentioned above, you can test migrations locallay by running the following test for each major version of postgres one at a time.
138+
139+
Examples:
140+
141+
```
142+
nix build .#checks.aarch64-darwin.psql_15 -L
143+
nix build .#checks.aarch64-darwin.psql_17 -L
144+
nix build .#checks.aarch64-darwin.psql_orioledb-17 -L
145+
```
146+
147+
(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)
148+
149+
At the end of these commands, you will see the output of both `pg_regress` tests, and migration tests
150+
151+
see [Adding Tests](https://github.com/supabase/postgres/blob/develop/nix/docs/adding-tests.md) for more information.

0 commit comments

Comments
 (0)