sqitch
sqitch copied to clipboard
Unexpected behavior when deploy script is missing
Steps to reproduce
- Set up a Sqitch project where some changes’ deploy scripts are missing.
- Run
sqitch deploy
Or equivalently, run these commands:
sqitch init ...
sqitch add test1
sqitch add test2
rm deploy/test1.sql
rm deploy/test2.sql
sqitch deploy
Expected behavior
- Sqitch should fail with an error the first time a plan with a missing deploy script is encountered, preferably before deploying anything.
Actual behavior
- The first change with a missing deploy script succeeds, leaving a null value in changes.script_hash.
- The second change with a missing deploy script fails due to the unique constraint on changes.script_hash, with the confusing error message “The deploy script is not unique”.
Other notes
Tested using Sqitch 1.4.1 with the Oracle database driver. On Oracle (and some other platforms), a unique constraint on a null column allows at most one null value on that column.