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

0022_repo_templates.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.

0022_repo_templates.sqlBlame34 lines · 1 contributor
71cd5ecClaude1-- Gluecron migration 0022: Template repositories + transfer history.
2--
3-- I2 — Template repositories. Owners can flag a repo as a "template" via
4-- settings; other users can then click "Use this template" to create a new
5-- repo seeded from the template's disk state. The seed flow is handled in
6-- application code (repositories.ts); this migration just adds the column.
7--
8-- I3 — Repository transfer history (audit trail of ownership changes). The
9-- primary `repositories.owner_id` / `org_id` fields carry the current owner;
10-- this table records prior owners so a transferred repo can prove provenance.
11
12--> statement-breakpoint
13ALTER TABLE "repositories"
14 ADD COLUMN IF NOT EXISTS "is_template" boolean NOT NULL DEFAULT false;
15
16--> statement-breakpoint
17CREATE INDEX IF NOT EXISTS "repos_is_template" ON "repositories" ("is_template") WHERE "is_template" = true;
18
19--> statement-breakpoint
20CREATE TABLE IF NOT EXISTS "repo_transfers" (
21 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
22 "repository_id" uuid NOT NULL,
23 "from_owner_id" uuid NOT NULL,
24 "from_org_id" uuid,
25 "to_owner_id" uuid NOT NULL,
26 "to_org_id" uuid,
27 "initiated_by" uuid NOT NULL,
28 "created_at" timestamp DEFAULT now() NOT NULL,
29 CONSTRAINT "repo_transfers_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade,
30 CONSTRAINT "repo_transfers_init_fk" FOREIGN KEY ("initiated_by") REFERENCES "users"("id") ON DELETE cascade
31);
32
33--> statement-breakpoint
34CREATE INDEX IF NOT EXISTS "repo_transfers_repo" ON "repo_transfers" ("repository_id", "created_at");