Files
windmill/backend/migrations/20260413045437_fork_deployment_requests.up.sql
Ruben Fiszel 64c58c824f feat: add deploy restriction rule and fork review requests (#8804)
* feat: add deploy restriction rule and fork review requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update ee-repo-ref.txt for fork review requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR review comments on fork review requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: rename fork review requests to deployment requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update ee-repo-ref.txt for deployment request rename

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: inline deployment request panel into deploy layout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: place Request deployment button to the left of Deploy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: inline fork triggers into main deploy list

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: open real trigger detail drawer for inline fork triggers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: email notifications for merge completion and reply pings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update deployment_request + protection_rule tables on workspace id rename

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update ee-repo-ref to 972893c3870e4c4a70a35748abed282d88904805

This commit updates the EE repository reference after PR #528 was merged in windmill-ee-private.

Previous ee-repo-ref: 5684d1c17d930b17849c1e5d7577891e64682d45

New ee-repo-ref: 972893c3870e4c4a70a35748abed282d88904805

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-04-13 17:10:37 +00:00

71 lines
3.5 KiB
SQL

-- Fork deployment requests: a lightweight request + comments layer on top
-- of the workspace fork/merge flow.
--
-- When a fork author can't deploy to the parent workspace (because the
-- RestrictDeployToDeployers rule is active and they aren't admin / wm_deployers),
-- they open a deployment request naming one or more eligible deployers as
-- assignees. Assignees comment, the chosen deployer performs the merge,
-- and the request auto-closes on success. There can only be one open
-- request per (source, fork) pair — enforced by the partial unique index.
CREATE TABLE workspace_fork_deployment_request (
id BIGSERIAL PRIMARY KEY,
source_workspace_id VARCHAR(50) NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
fork_workspace_id VARCHAR(50) NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
requested_by VARCHAR(255) NOT NULL,
requested_by_email VARCHAR(255) NOT NULL,
requested_at TIMESTAMPTZ NOT NULL DEFAULT now(),
closed_at TIMESTAMPTZ,
closed_reason VARCHAR(20)
);
-- Only one open deployment request per (source, fork). Closed requests
-- accumulate freely for history.
CREATE UNIQUE INDEX workspace_fork_deployment_request_open_unique
ON workspace_fork_deployment_request (source_workspace_id, fork_workspace_id)
WHERE closed_at IS NULL;
CREATE INDEX workspace_fork_deployment_request_fork_idx
ON workspace_fork_deployment_request (fork_workspace_id, closed_at);
-- Assignees for a deployment request — the users asked to merge. Username
-- + email are snapshotted at request creation so notification dispatch
-- doesn't depend on the user's current workspace membership.
CREATE TABLE workspace_fork_deployment_request_assignee (
request_id BIGINT NOT NULL REFERENCES workspace_fork_deployment_request(id) ON DELETE CASCADE,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
PRIMARY KEY (request_id, username)
);
-- Comments on a deployment request. `parent_id` threads replies under a
-- top-level comment (2 levels max, enforced in application code).
-- `anchor_kind`/`anchor_path` pin a comment to a specific diff row; both
-- NULL = general comment about the whole fork. Anchored comments flip to
-- obsolete when the underlying item is updated in the fork, and all
-- comments on a request are marked obsolete on successful merge.
CREATE TABLE workspace_fork_deployment_request_comment (
id BIGSERIAL PRIMARY KEY,
request_id BIGINT NOT NULL REFERENCES workspace_fork_deployment_request(id) ON DELETE CASCADE,
parent_id BIGINT REFERENCES workspace_fork_deployment_request_comment(id) ON DELETE CASCADE,
author VARCHAR(255) NOT NULL,
author_email VARCHAR(255) NOT NULL,
body TEXT NOT NULL,
anchor_kind VARCHAR(50),
anchor_path VARCHAR(255),
obsolete BOOLEAN NOT NULL DEFAULT false,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT anchor_kind_path_both_or_neither
CHECK ((anchor_kind IS NULL) = (anchor_path IS NULL))
);
CREATE INDEX workspace_fork_deployment_request_comment_request_idx
ON workspace_fork_deployment_request_comment (request_id);
-- Anchored-comment lookup: find all open-request comments pinned to a
-- specific (kind, path) — used when we mark comments obsolete after an
-- item in the fork is updated.
CREATE INDEX workspace_fork_deployment_request_comment_anchor_idx
ON workspace_fork_deployment_request_comment (request_id, anchor_kind, anchor_path)
WHERE anchor_kind IS NOT NULL;