1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! One-shot migration runner.
//!
//! Connects to `DATABASE_URL`, applies the embedded idempotent schema,
//! and exits 0. Designed to run as the `migrations` service in
//! [docker-compose.yml](../../docker-compose.yml); the api and worker
//! services then wait on `service_completed_successfully` before
//! starting, so they never observe a half-migrated schema.
//!
//! Re-running this against an already-migrated database is a no-op.
//! Running it against a database from a previous version of the crate
//! is safe as long as the schema remains compatible with the embedded
//! migration.
//!
//! Why a separate binary instead of bolting the migration into the
//! api/worker startup: with multiple worker pods, running migrations on
//! every startup adds unnecessary coordination. One dedicated container
//! runs exactly once per deployment.
use Context;
use ;
use EnvFilter;
async