sqlx-migrations

Manage SQLx database migrations with compile-time embedding or sqlx-cli workflows.

Updated May 26, 2026
One-click install
npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-migrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlx-migrations
Source: https://github.com/adelabdelgawad/rust-fullstack-agents/tree/main/plugins/rusty/skills/sqlx-migrations
Command: npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-migrations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies and secures the management of SQLx migrations by enforcing a consistent workflow, embedding migrations in binaries when desired, and providing a safe CLI path for deployment.

Core Features & Use Cases

  • File naming convention for migrations (timestamped up migrations) to ensure deterministic order.
  • Destructive DDL safety: require marker -- @destructive on the first line of destructive migrations.
  • Dual deployment strategies: compile-time embedding via sqlx::migrate!() and sqlx-cli at deploy.
  • CI validation: automated checks to ensure migrations apply cleanly in fresh databases.

Quick Start

Create a new migration with sqlx migrate add <name> and enable compile-time embedding with sqlx::migrate!() in your startup code.

Frequently Asked Questions about sqlx-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I embed SQLx migrations at compile time in Rust?

To embed SQLx migrations at compile time, use the sqlx::migrate!() macro in your startup code. This bundles timestamped migration files directly into the Rust binary, ensuring deterministic schema changes without external file dependencies during deployment.

What is the best way to prevent destructive DDL in SQLx database migrations?

To prevent destructive DDL in SQLx database migrations, require a -- @destructive marker on the first line of dangerous migration files. This safety mechanism explicitly flags potentially harmful schema changes, preventing accidental data loss during automated deployment workflows.

How do I validate SQLx migrations apply cleanly in a CI pipeline?

To validate SQLx migrations apply cleanly in CI, run automated checks against a fresh database instance before deployment. This CI-ready validation ensures timestamped migration files execute successfully and deterministically, catching schema conflicts early in the development pipeline.

Does SQLx support both CLI and embedded migration deployment strategies?

Yes, SQLx supports dual deployment strategies for database migrations. You can use sqlx-cli workflows for command-line deployment at runtime, or compile-time embedding via sqlx::migrate!() to bundle migrations directly into your Rust application binary.

Why do my SQLx database migrations fail to apply in deterministic order?

SQLx database migrations fail in deterministic order if file naming conventions are not strictly timestamped. Ensure all up migration files use consistent timestamp prefixes to guarantee the exact sequential execution order required for reliable schema changes.