Skip to content

Commit 4fb7102

Browse files
committed
fix: CI, README for multi-tenant
1 parent 15df159 commit 4fb7102

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/workflows/examples.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,16 @@ jobs:
178178
- name: Multi-Tenant (Setup)
179179
working-directory: examples/postgres/multi-tenant
180180
env:
181-
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
181+
DATABASE_URL: postgres://postgres:password@localhost:5432/multi-tenant
182182
run: |
183183
(cd accounts && sqlx db setup)
184184
(cd payments && sqlx migrate run)
185185
sqlx migrate run
186186
187-
- name: Mockable TODOs (Run)
187+
- name: Multi-Tenant (Run)
188188
env:
189-
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
190-
run: cargo run -p sqlx-example-postgres-mockable-todos
189+
DATABASE_URL: postgres://postgres:password@localhost:5432/multi-tenant
190+
run: cargo run -p sqlx-example-postgres-multi-tenant
191191

192192
- name: TODOs (Setup)
193193
working-directory: examples/postgres/todos

examples/postgres/multi-tenant/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,31 @@ This example uses schema-qualified names everywhere for clarity.
1919
It can be tempting to change the `search_path` of the connection (MySQL, Postgres) to eliminate the need for schema
2020
prefixes, but this can cause some really confusing issues when names conflict.
2121

22-
This example will generate a `_sqlx_migrations` table in three different schemas, and if `search_path` is set
22+
This example will generate a `_sqlx_migrations` table in three different schemas; if `search_path` is set
2323
to `public,accounts,payments` and the migrator for the main application attempts to reference the table unqualified,
2424
it would throw an error.
2525

2626
# Setup
2727

2828
This example requires running three different sets of migrations.
2929

30-
Ensure `sqlx-cli` is installed with Postgres support.
30+
Ensure `sqlx-cli` is installed with Postgres and `sqlx.toml` support:
3131

32-
Start a Postgres server.
32+
```
33+
cargo install sqlx-cli --features postgres,sqlx-toml
34+
```
35+
36+
Start a Postgres server (shown here using Docker, `run` command also works with `podman`):
3337

34-
Create `.env` with `DATABASE_URL` or set it in your shell environment.
38+
```
39+
docker run -d -e POSTGRES_PASSWORD=password -p 5432:5432 --name postgres postgres:latest
40+
```
41+
42+
Create `.env` with `DATABASE_URL` or set the variable in your shell environment;
43+
44+
```
45+
DATABASE_URL=postgres://postgres:password@localhost/example-multi-tenant
46+
```
3547

3648
Run the following commands:
3749

0 commit comments

Comments
 (0)