Skip to content

Commit 1b0c64a

Browse files
committed
chore(ci): test multi-tenant example
1 parent 46878e8 commit 1b0c64a

File tree

7 files changed

+54
-32
lines changed

7 files changed

+54
-32
lines changed

.github/workflows/examples.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
key: sqlx-cli
2323

2424
- run: >
25-
cargo build
26-
-p sqlx-cli
27-
--bin sqlx
28-
--release
29-
--no-default-features
30-
--features mysql,postgres,sqlite
25+
cargo build
26+
-p sqlx-cli
27+
--bin sqlx
28+
--release
29+
--no-default-features
30+
--features mysql,postgres,sqlite
3131
3232
- uses: actions/upload-artifact@v4
3333
with:
@@ -98,7 +98,7 @@ jobs:
9898
name: sqlx-cli
9999
path: /home/runner/.local/bin
100100

101-
- run: |
101+
- run: |
102102
ls -R /home/runner/.local/bin
103103
chmod +x $HOME/.local/bin/sqlx
104104
echo $HOME/.local/bin >> $GITHUB_PATH
@@ -175,6 +175,20 @@ jobs:
175175
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
176176
run: cargo run -p sqlx-example-postgres-mockable-todos
177177

178+
- name: Multi-Tenant (Setup)
179+
working-directory: examples/postgres/multi-tenant
180+
env:
181+
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
182+
run: |
183+
(cd accounts && sqlx db setup)
184+
(cd payments && sqlx migrate run)
185+
sqlx migrate run
186+
187+
- name: Mockable TODOs (Run)
188+
env:
189+
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
190+
run: cargo run -p sqlx-example-postgres-mockable-todos
191+
178192
- name: TODOs (Setup)
179193
working-directory: examples/postgres/todos
180194
env:

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ members = [
1111
"sqlx-postgres",
1212
"sqlx-sqlite",
1313
"examples/mysql/todos",
14-
"examples/postgres/multi-tenant",
1514
"examples/postgres/axum-social-with-tests",
1615
"examples/postgres/chat",
1716
"examples/postgres/files",
1817
"examples/postgres/json",
1918
"examples/postgres/listen",
20-
"examples/postgres/todos",
2119
"examples/postgres/mockable-todos",
20+
"examples/postgres/multi-tenant",
21+
"examples/postgres/todos",
2222
"examples/postgres/transaction",
2323
"examples/sqlite/todos",
2424
]

examples/postgres/multi-tenant/Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "axum-multi-tenant"
2+
name = "sqlx-example-postgres-multi-tenant"
33
version.workspace = true
44
license.workspace = true
55
edition.workspace = true
@@ -9,9 +9,6 @@ categories.workspace = true
99
authors.workspace = true
1010

1111
[dependencies]
12-
accounts = { path = "accounts" }
13-
payments = { path = "payments" }
14-
1512
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
1613

1714
sqlx = { path = "../../..", version = "0.8.3", features = ["runtime-tokio", "postgres"] }
@@ -26,5 +23,13 @@ rust_decimal = "1.36.0"
2623

2724
rand = "0.8.5"
2825

26+
[dependencies.accounts]
27+
package = "sqlx-example-postgres-multi-tenant-accounts"
28+
path = "accounts"
29+
30+
[dependencies.payments]
31+
package = "sqlx-example-postgres-multi-tenant-accounts"
32+
path = "payments"
33+
2934
[lints]
3035
workspace = true

examples/postgres/multi-tenant/accounts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "accounts"
2+
name = "sqlx-example-postgres-multi-tenant-accounts"
33
version = "0.1.0"
44
edition = "2021"
55

examples/postgres/multi-tenant/payments/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "payments"
2+
name = "sqlx-example-postgres-multi-tenant-payments"
33
version = "0.1.0"
44
edition = "2021"
55

examples/postgres/multi-tenant/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ async fn main() -> eyre::Result<()> {
4545

4646
txn.commit().await?;
4747

48-
println!("created account ID: {}, email: {user_email:?}, password: {user_password:?}", account_id.0);
48+
println!(
49+
"created account ID: {}, email: {user_email:?}, password: {user_password:?}",
50+
account_id.0
51+
);
4952

5053
// POST /session
5154
// Log the user in.

0 commit comments

Comments
 (0)