0
SQL migration scripts with a tested rollback path
Write a database migration for: change_description in database. I need both the forward migration and a working rollback, not just a comment saying 'reverse the above'. Format:
1. Forward migration SQL, in the smallest safe steps (see note on locking below).
2. Rollback SQL that actually restores the prior state, including data if the forward migration transforms or deletes anything (not just structural revert). If perfect rollback is impossible (e.g. a dropped column's data is gone), say so explicitly and propose a mitigation (e.g. rename instead of drop, keep for one release cycle).
3. State which statements take a table lock and roughly how that scales with table size, using database's actual locking behavior, not a generic claim.
4. Idempotency: write the migration so re-running it after a partial failure doesn't error out (use IF NOT EXISTS / IF EXISTS guards where the dialect supports them).
5. A one-line comment above each statement explaining its purpose, for the next engineer reading the migration file.
Current schema: schema
Change needed: change_description