Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides schema-first Postgres persistence in Rust services using sqlx, covering migrations, compile-checked queries, transactions and tests.
68% 82%+14 ptsof test cases passed
Passed 18 of 22 test cases with the skill, and 15 of 22 without it.
We have an existing table `user_sessions` containing legacy record data, and we want to add a foreign key constraint referencing `users(id)`. What sequence should be followed during the migration?
The foreign key constraint is added only after existing data is validated.
3 of 3 safety checks passed
Use this skill to make Rust/Postgres changes schema-first, compile-checked, and testable. Prefer explicit migrations, injected pools, narrow repository functions, and transaction boundaries that match the business operation.
Cargo.toml, migrations/, .sqlx/, docker-compose.yml, CI, and
existing database helper modules before changing code.sqlx::query! and query_as! for compile-time checked SQL. Use
dynamic SQL only when the query shape truly changes at runtime.PgPool, PgConnection, or Transaction explicitly. Do not create a
pool inside handlers or repository functions.Read references/migration-safety.md before changing existing tables or data.
Default migration preferences:
not null, uniqueness, and foreign-key constraints only after existing
data satisfies them.Next to this one in the catalogue, plus more from the same author.