Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-7072 chore(db): drop the reference_only column (#8253)

Bohan Jiang023c349f5f8d
diff --git a/server/migrations/468_drop_reference_only_column.down.sql b/server/migrations/468_drop_reference_only_column.down.sql
new file mode 100644
index 0000000000..49d93f20e2
--- /dev/null
+++ b/server/migrations/468_drop_reference_only_column.down.sql
@@ -0,0 +1,11 @@
+-- Re-add the column so an instance of the release before MUL-7072 can run against
+-- a rolled-back schema: that code lists reference_only in its link INSERT, and
+-- the default matches what it wrote for a claimed key.
+--
+-- The rows the up migration deleted do not come back. They recorded only "this PR
+-- body mentioned this key", which the PR body itself still says, and no read path
+-- has returned them since MUL-7072.
+ALTER TABLE issue_pull_request
+ ADD COLUMN reference_only BOOLEAN NOT NULL DEFAULT FALSE;
+ALTER TABLE issue_vcs_pull_request
+ ADD COLUMN reference_only BOOLEAN NOT NULL DEFAULT FALSE;
diff --git a/server/migrations/468_drop_reference_only_column.up.sql b/server/migrations/468_drop_reference_only_column.up.sql
new file mode 100644
index 0000000000..3d48ba3715
--- /dev/null
+++ b/server/migrations/468_drop_reference_only_column.up.sql
@@ -0,0 +1,16 @@
+-- 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;
diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.go
index e8032eb091..40af69e1f2 100644
--- a/server/pkg/db/generated/models.go
+++ b/server/pkg/db/generated/models.go
@@ -831,7 +831,6 @@ type IssuePullRequest struct {
LinkedByID pgtype.UUID `json:"linked_by_id"`
LinkedAt pgtype.Timestamptz `json:"linked_at"`
CloseIntent bool `json:"close_intent"`
- ReferenceOnly bool `json:"reference_only"`
}
type IssueReaction struct {
@@ -908,7 +907,6 @@ type IssueVcsPullRequest struct {
IssueID pgtype.UUID `json:"issue_id"`
PullRequestID pgtype.UUID `json:"pull_request_id"`
CloseIntent bool `json:"close_intent"`
- ReferenceOnly bool `json:"reference_only"`
LinkedByType pgtype.Text `json:"linked_by_type"`
LinkedByID pgtype.UUID `json:"linked_by_id"`
LinkedAt pgtype.Timestamptz `json:"linked_at"`