hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | #!/usr/bin/env bash |
| 2 | # Refresh the sqlx "prepare" database: the ONE database whose schema is the |
| 3 | # union of migrations/control/*.sql + migrations/school/*.sql, against which |
| 4 | # sqlx's compile-time query macros check every query (`cargo sqlx prepare`, |
| 5 | # and plain `cargo check` with DATABASE_URL set — see .env.example). |
| 6 | # |
| 7 | # DISJOINTNESS INVARIANT: control tables (school, builder, builder_session, |
| 8 | # rate_limit) and school tables must never collide on a name — the union is |
| 9 | # applied to this single database. The loop below fails loudly (psql |
| 10 | # ON_ERROR_STOP=1) if a name ever collides. |
| 11 | # |
| 12 | # Raw apply, on purpose: no `sqlx migrate run`, so no `_sqlx_migrations` |
| 13 | # tracking rows exist and the control and school file sets never share a |
| 14 | # tracking table. The database is dropped and recreated on every run, so the |
| 15 | # result is deterministic. |
| 16 | # |
| 17 | # Requires the compose Postgres: `podman compose up -d postgres`. |
| 18 | |
| 19 | |
| 20 | CONTAINER="" |
| 21 | PREPARE_DB="" |
| 22 | HERE="" |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | applied=0 |
| 35 | for; do |
| 36 | for; do |
| 37 | |
| 38 | |
| 39 | applied= |
| 40 | done |
| 41 | done |
| 42 | |
| 43 | |
| 44 |