CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0016_wikis.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.
| 1e162a8 | 1 | -- Gluecron migration 0016: Block E3 — Wikis. |
| 2 | -- | |
| 3 | -- DB-backed wiki for v1 (git-backed mirror is a future upgrade). Each repo | |
| 4 | -- owns a collection of wiki_pages keyed on slug, with revisions stored | |
| 5 | -- incrementally for history/diff/revert. | |
| 6 | -- | |
| 7 | -- Tables: | |
| 8 | -- wiki_pages — current content per slug | |
| 9 | -- wiki_revisions — append-only history (body + message + author) | |
| 10 | ||
| 11 | --> statement-breakpoint | |
| 12 | CREATE TABLE IF NOT EXISTS "wiki_pages" ( | |
| 13 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | |
| 14 | "repository_id" uuid NOT NULL, | |
| 15 | "slug" text NOT NULL, | |
| 16 | "title" text NOT NULL, | |
| 17 | "body" text NOT NULL DEFAULT '', | |
| 18 | "revision" integer NOT NULL DEFAULT 1, | |
| 19 | "created_at" timestamp DEFAULT now() NOT NULL, | |
| 20 | "updated_at" timestamp DEFAULT now() NOT NULL, | |
| 21 | "updated_by" uuid, | |
| 22 | CONSTRAINT "wiki_pages_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade, | |
| 23 | CONSTRAINT "wiki_pages_author_fk" FOREIGN KEY ("updated_by") REFERENCES "users"("id") | |
| 24 | ); | |
| 25 | ||
| 26 | --> statement-breakpoint | |
| 27 | CREATE INDEX IF NOT EXISTS "wiki_pages_repo" ON "wiki_pages" ("repository_id"); | |
| 28 | --> statement-breakpoint | |
| 29 | CREATE UNIQUE INDEX IF NOT EXISTS "wiki_pages_repo_slug" ON "wiki_pages" ("repository_id", "slug"); | |
| 30 | ||
| 31 | --> statement-breakpoint | |
| 32 | CREATE TABLE IF NOT EXISTS "wiki_revisions" ( | |
| 33 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | |
| 34 | "page_id" uuid NOT NULL, | |
| 35 | "revision" integer NOT NULL, | |
| 36 | "title" text NOT NULL, | |
| 37 | "body" text NOT NULL DEFAULT '', | |
| 38 | "message" text, | |
| 39 | "author_id" uuid NOT NULL, | |
| 40 | "created_at" timestamp DEFAULT now() NOT NULL, | |
| 41 | CONSTRAINT "wiki_revisions_page_fk" FOREIGN KEY ("page_id") REFERENCES "wiki_pages"("id") ON DELETE cascade, | |
| 42 | CONSTRAINT "wiki_revisions_author_fk" FOREIGN KEY ("author_id") REFERENCES "users"("id") | |
| 43 | ); | |
| 44 | ||
| 45 | --> statement-breakpoint | |
| 46 | CREATE INDEX IF NOT EXISTS "wiki_revisions_page" ON "wiki_revisions" ("page_id", "revision"); |