CREATE TABLE IF NOT EXISTS "pages_deployments" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"repository_id" uuid NOT NULL,
"ref" text NOT NULL DEFAULT 'refs/heads/gh-pages',
"commit_sha" text NOT NULL,
"status" text NOT NULL DEFAULT 'success',
"triggered_by" uuid,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "pages_deployments_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade,
CONSTRAINT "pages_deployments_user_fk" FOREIGN KEY ("triggered_by") REFERENCES "users"("id") ON DELETE set null
);
CREATE INDEX IF NOT EXISTS "pages_deployments_repo" ON "pages_deployments" ("repository_id");
CREATE INDEX IF NOT EXISTS "pages_deployments_created" ON "pages_deployments" ("created_at");
CREATE TABLE IF NOT EXISTS "pages_settings" (
"repository_id" uuid PRIMARY KEY NOT NULL,
"enabled" boolean NOT NULL DEFAULT true,
"source_branch" text NOT NULL DEFAULT 'gh-pages',
"source_dir" text NOT NULL DEFAULT '/',
"custom_domain" text,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "pages_settings_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade
);
|