Use the SQLx CLI to create migration files instead of manually creating timestamped files.
-
Identify the project or crate root where SQLx migrations should live.
- Prefer the directory that contains an existing
migrations/ directory.
- If there are multiple crates/projects, ask the user which one unless the target is obvious.
-
Convert the requested migration description to a short snake_case name, for example create_users_table.
-
Run just rust/cloud-storage/setup_test_envs from the project root
-
Run the SQLx CLI from rust/cloud-storage/macro_db_client folder:
cargo sqlx migrate add name_of_migration
Replace name_of_migration with the actual snake_case migration name.
-
Do not manually add timestamps or hand-create migration filenames; sqlx migrate add generates the correct timestamped file.
-
After the command succeeds, read the generated migration file and add the requested SQL changes there.
-
If sqlx is not installed or not on PATH, stop and tell the user to install sqlx-cli rather than manually creating the migration file.