Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

0032_repo_rulesets.sql

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

0032_repo_rulesets.sqlBlame32 lines · 1 contributor
9ff7128Claude1-- Block J6 — Repository rulesets.
2--
3-- Extends the legacy branch_protection table with a policy engine that can
4-- scope rules at the repo (v1) or org level (future). Each ruleset groups
5-- N rules; an evaluator short-circuits on enforcement=active with block=true
6-- and merely logs when enforcement=evaluate.
7
8CREATE TABLE IF NOT EXISTS "repo_rulesets" (
9 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
10 "repository_id" uuid NOT NULL REFERENCES "repositories"("id") ON DELETE CASCADE,
11 "name" text NOT NULL,
12 "enforcement" text NOT NULL DEFAULT 'active', -- 'active' | 'evaluate' | 'disabled'
13 "created_by" uuid REFERENCES "users"("id") ON DELETE SET NULL,
14 "created_at" timestamp NOT NULL DEFAULT now(),
15 "updated_at" timestamp NOT NULL DEFAULT now()
16);
17
18CREATE INDEX IF NOT EXISTS "repo_rulesets_repo_idx"
19 ON "repo_rulesets" ("repository_id");
20CREATE UNIQUE INDEX IF NOT EXISTS "repo_rulesets_repo_name_unique"
21 ON "repo_rulesets" ("repository_id", "name");
22
23CREATE TABLE IF NOT EXISTS "ruleset_rules" (
24 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
25 "ruleset_id" uuid NOT NULL REFERENCES "repo_rulesets"("id") ON DELETE CASCADE,
26 "rule_type" text NOT NULL,
27 "params" text NOT NULL DEFAULT '{}', -- JSON
28 "created_at" timestamp NOT NULL DEFAULT now()
29);
30
31CREATE INDEX IF NOT EXISTS "ruleset_rules_set_idx"
32 ON "ruleset_rules" ("ruleset_id");