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

0026_repo_mirrors.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.

0026_repo_mirrors.sqlBlame36 lines · 1 contributor
4a0dea1Claude1-- Gluecron migration 0026: Repository mirroring.
2--
3-- I9 — Pull-style mirroring. A mirrored repository has an upstream URL
4-- that we periodically `git fetch` from (via admin-trigger or cron). We
5-- keep a single row per repo (one mirror per mirrored repo) plus an
6-- append-only log of sync attempts for audit.
7
8--> statement-breakpoint
9CREATE TABLE IF NOT EXISTS "repo_mirrors" (
10 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
11 "repository_id" uuid NOT NULL UNIQUE
12 REFERENCES "repositories"("id") ON DELETE CASCADE,
13 "upstream_url" text NOT NULL,
14 "interval_minutes" integer NOT NULL DEFAULT 1440,
15 "last_synced_at" timestamp,
16 "last_status" text, -- "ok" | "error" | null (never synced)
17 "last_error" text,
18 "is_enabled" boolean NOT NULL DEFAULT true,
19 "created_at" timestamp NOT NULL DEFAULT now(),
20 "updated_at" timestamp NOT NULL DEFAULT now()
21);
22
23--> statement-breakpoint
24CREATE TABLE IF NOT EXISTS "repo_mirror_runs" (
25 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
26 "mirror_id" uuid NOT NULL REFERENCES "repo_mirrors"("id") ON DELETE CASCADE,
27 "started_at" timestamp NOT NULL DEFAULT now(),
28 "finished_at" timestamp,
29 "status" text NOT NULL DEFAULT 'running', -- running | ok | error
30 "message" text,
31 "exit_code" integer
32);
33
34--> statement-breakpoint
35CREATE INDEX IF NOT EXISTS "repo_mirror_runs_mirror_id_idx"
36 ON "repo_mirror_runs" ("mirror_id", "started_at" DESC);