Files
events-hub/backend/prisma/migrations/20261028064313_releases_notices/migration.sql
T
joshuaandClaude Opus 5.5 1449e5046e Releases with what's new, notices to churches, withdrawn update requests
- Releases page: each Cross Events version with notes and an urgent flag; the
  newest is the latest version (moved off Settings; the old setting becomes the
  first release). Installs get the notes for every newer version.
- Notices page: a banner for site admins and supervisors (with a time window),
  an email to the customer and admin contact, or both; for every install or
  chosen ones.
- POST /api/installs/update-request/cancel resolves the request and emails Joshua.
- Protocol doc: releases and notices in the heartbeat/register replies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 08:54:35 +02:00

46 lines
1.6 KiB
SQL

-- CreateEnum
CREATE TYPE "NoticeLevel" AS ENUM ('info', 'maintenance', 'warning');
-- CreateTable
CREATE TABLE "Release" (
"id" TEXT NOT NULL,
"version" TEXT NOT NULL,
"notes" TEXT NOT NULL DEFAULT '',
"urgent" BOOLEAN NOT NULL DEFAULT false,
"releasedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Release_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Notice" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"message" TEXT NOT NULL,
"level" "NoticeLevel" NOT NULL DEFAULT 'info',
"allInstalls" BOOLEAN NOT NULL DEFAULT true,
"installIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"showBanner" BOOLEAN NOT NULL DEFAULT true,
"startsAt" TIMESTAMP(3),
"endsAt" TIMESTAMP(3),
"emailedAt" TIMESTAMP(3),
"emailedTo" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Notice_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Release_version_key" ON "Release"("version");
-- CreateIndex
CREATE INDEX "Notice_endsAt_idx" ON "Notice"("endsAt");
-- The latest version set on the Settings page becomes the first release (no notes yet).
INSERT INTO "Release" ("id", "version", "notes", "urgent", "releasedAt", "createdAt", "updatedAt")
SELECT gen_random_uuid()::text, "value", '', false, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
FROM "Setting" WHERE "key" = 'latest_version' AND "value" <> '';