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

0011_environments.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.

0011_environments.sqlBlame37 lines · 1 contributor
e2da5c6Claude1-- Gluecron migration 0011: Block C4 — Environments with protected approvals.
2--
3-- Tables:
4-- environments — per-repo named environments (production, staging, preview)
5-- deployment_approvals — approve/reject decisions on a pending deployment
6
7--> statement-breakpoint
8CREATE TABLE IF NOT EXISTS "environments" (
9 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
10 "repository_id" uuid NOT NULL,
11 "name" text NOT NULL,
12 "require_approval" boolean NOT NULL DEFAULT false,
13 "reviewers" text NOT NULL DEFAULT '[]',
14 "wait_timer_minutes" integer NOT NULL DEFAULT 0,
15 "allowed_branches" text NOT NULL DEFAULT '[]',
16 "created_at" timestamp DEFAULT now() NOT NULL,
17 "updated_at" timestamp DEFAULT now() NOT NULL,
18 CONSTRAINT "environments_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade
19);
20
21--> statement-breakpoint
22CREATE UNIQUE INDEX IF NOT EXISTS "environments_repo_name" ON "environments" ("repository_id", "name");
23
24--> statement-breakpoint
25CREATE TABLE IF NOT EXISTS "deployment_approvals" (
26 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
27 "deployment_id" uuid NOT NULL,
28 "user_id" uuid NOT NULL,
29 "decision" text NOT NULL,
30 "comment" text,
31 "created_at" timestamp DEFAULT now() NOT NULL,
32 CONSTRAINT "deployment_approvals_deployment_fk" FOREIGN KEY ("deployment_id") REFERENCES "deployments"("id") ON DELETE cascade,
33 CONSTRAINT "deployment_approvals_user_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade
34);
35
36--> statement-breakpoint
37CREATE INDEX IF NOT EXISTS "deployment_approvals_deployment" ON "deployment_approvals" ("deployment_id");