Files
multica/server/migrations/468_drop_reference_only_column.up.sql
Bohan Jiang 023c349f5f MUL-7072 chore(db): drop the reference_only column (#8253)
Contract half of the pair #8245 started, now that #8245 is live everywhere: since that release a bare body mention of an issue key writes no link row, and no query reads or writes the column.

Migration 468 deletes any reference_only rows an instance of the older release could still have written during #8245's rollout — once the column is gone such a row would be indistinguishable from a real link, visible in the issue's PR list and blocking auto-advance while its PR is open — and then drops the column from issue_pull_request and issue_vcs_pull_request. sqlc drops the two phantom struct fields with it.

The down migration re-adds the column so a pre-#8245 instance can run against a rolled-back schema; the deleted rows do not come back and no read path has returned them since #8245.
2026-09-13 19:12:34 +08:00

17 lines
987 B
SQL

-- Drop reference_only, the contract half of the pair MUL-7072 started. Since that
-- release a bare body mention of an issue key writes no link row at all, and no
-- query reads or writes this column. It may only run once every instance of the
-- previous release is gone: an older instance still names the column in its link
-- INSERT and would fail on every link write against this schema.
--
-- The DELETE repeats as a mop-up. Migration 462 cleared the historical hidden
-- rows, but instances still serving during that rollout could write a few more,
-- and once the column is gone such a row becomes indistinguishable from a real
-- link — visible in the issue's PR list and, while its PR is in flight, blocking
-- the issue from auto-advancing.
DELETE FROM issue_pull_request WHERE reference_only;
DELETE FROM issue_vcs_pull_request WHERE reference_only;
ALTER TABLE issue_pull_request DROP COLUMN reference_only;
ALTER TABLE issue_vcs_pull_request DROP COLUMN reference_only;