From 193206417d7bfc3bff383ce3a986c6dbd980bd75 Mon Sep 17 00:00:00 2001 From: Mew Date: Sun, 29 Nov 2026 02:57:29 -0800 Subject: [PATCH] feat(publishing): shared Publishing page with shift open/close windows (#869) Mew 2026-11-29: "lets start with A ... shift closes it is hidden". op_shift_release rows become windows: all on-playa shifts from a date (as before) or one shift type (meetings included), with an optional close time. Volunteers can't see or sign up before a window opens or after it closes; admins still see them (sign-up warns). New /publishing page holds the windows and lists every form's Opens/Closes; Dates links to it. Migration 036. Footer 2027.G.00900.C. Co-Authored-By: Claude Opus 5.5 --- client/e2e/tests/30-shift-release.spec.ts | 73 +++++++ client/src/app/dates/Dates.tsx | 8 +- client/src/app/dates/ShiftRelease.tsx | 106 --------- client/src/app/publishing/Publishing.tsx | 226 ++++++++++++++++++++ client/src/app/publishing/page.tsx | 14 ++ client/src/components/api/shiftAddRules.ts | 14 +- client/src/components/layout/Footer.tsx | 2 +- client/src/components/layout/pageList.tsx | 7 + client/src/lib/shiftRelease.ts | 30 ++- client/src/pages/api/shift-release/index.ts | 44 +++- client/src/pages/api/shifts/index.ts | 4 +- migrations/036_shift_publishing.sql | 10 + 12 files changed, 404 insertions(+), 134 deletions(-) delete mode 100644 client/src/app/dates/ShiftRelease.tsx create mode 100644 client/src/app/publishing/Publishing.tsx create mode 100644 client/src/app/publishing/page.tsx create mode 100644 migrations/036_shift_publishing.sql diff --git a/client/e2e/tests/30-shift-release.spec.ts b/client/e2e/tests/30-shift-release.spec.ts index 8d5a677d..df8725f8 100644 --- a/client/e2e/tests/30-shift-release.spec.ts +++ b/client/e2e/tests/30-shift-release.spec.ts @@ -117,4 +117,77 @@ test.describe("shift release embargo (#869)", () => { .status() ).toBe(201); }); + + test("closed window hides it; a shift-type window covers meetings too", async ({ + request, + }) => { + const db = getPool(); + await db.execute("DELETE FROM op_shift_release"); + // all on-playa shifts: open since 2001, closed in 2002 + await db.execute( + "INSERT INTO op_shift_release (embargo_from, release_at, close_at, announced_at) VALUES (?, '2001-01-01 09:00:00', '2002-01-01 09:00:00', NOW())", + [shiftDate] + ); + // the meeting's own type: not open until 2099 + await db.execute( + "INSERT INTO op_shift_release (embargo_from, shift_name_id, release_at, announced_at) VALUES (?, ?, '2099-12-31 09:00:00', NOW())", + [shiftDate, MEETING.shiftNameId] + ); + const mine = await shifts(request, volunteer.shiftboardId); + expect( + mine.find((s) => s.id === FUTURE_SHIFT.shiftTimesId) + ).toBeUndefined(); + expect(mine.find((s) => s.id === MEETING.shiftTimesId)).toBeUndefined(); + const admins = await shifts(request, ADMIN); + expect(admins.find((s) => s.id === FUTURE_SHIFT.shiftTimesId)).toBeTruthy(); + + const pre = await request.post( + `/api/shifts/${FUTURE_SHIFT.shiftTimesId}/volunteers/preflight`, + { + headers: as(volunteer.shiftboardId), + data: JSON.stringify({ + shiftboardId: volunteer.shiftboardId, + timePositionId: FUTURE_SHIFT.timePositionId, + }), + } + ); + const { blockers } = await pre.json(); + expect(blockers.map((b: { code: string }) => b.code)).toContain( + "publish-closed" + ); + + const post = (body: object) => + request.post("/api/shift-release", { + headers: as(ADMIN), + data: JSON.stringify(body), + }); + expect( + ( + await post({ + closeAt: "2099-05-01T09:00", + embargoFrom: "2099-01-01", + releaseAt: "2099-06-01T09:00", + }) + ).status() + ).toBe(400); // closes before it opens + expect( + ( + await post({ + closeAt: "2099-07-01T09:00", + embargoFrom: "2099-01-01", + releaseAt: "2099-06-01T09:00", + shiftNameId: MEETING.shiftNameId, + }) + ).status() + ).toBe(201); + const rows = await ( + await request.get("/api/shift-release", { headers: as(ADMIN) }) + ).json(); + expect(rows).toContainEqual( + expect.objectContaining({ + closeAt: "2099-07-01 09:00:00", + shiftName: MEETING.shiftName, + }) + ); + }); }); diff --git a/client/src/app/dates/Dates.tsx b/client/src/app/dates/Dates.tsx index b931d6d6..7972eeb7 100644 --- a/client/src/app/dates/Dates.tsx +++ b/client/src/app/dates/Dates.tsx @@ -15,16 +15,17 @@ import { MenuItem, MenuList, Stack, + Typography, useTheme, } from "@mui/material"; import { useState } from "react"; import useSWR from "swr"; import { Hero } from "@/components/layout/Hero"; +import Link from "next/link"; import { DatesDialogCreate } from "@/app/dates/DatesDialogCreate"; import { DatesDialogDelete } from "@/app/dates/DatesDialogDelete"; import { DatesDialogUpdate } from "@/app/dates/DatesDialogUpdate"; -import { ShiftRelease } from "@/app/dates/ShiftRelease"; import { DataTable } from "@/components/general/DataTable"; import { ErrorPage } from "@/components/general/ErrorPage"; import { Loading } from "@/components/general/Loading"; @@ -233,7 +234,10 @@ export const Dates = () => { dateList={data} /> - + + When shifts open and close for sign-up is on{" "} + Publishing. + ); diff --git a/client/src/app/dates/ShiftRelease.tsx b/client/src/app/dates/ShiftRelease.tsx deleted file mode 100644 index 41828b9e..00000000 --- a/client/src/app/dates/ShiftRelease.tsx +++ /dev/null @@ -1,106 +0,0 @@ -"use client"; - -import { Box, Button, Stack, TextField, Typography } from "@mui/material"; -import { useSnackbar } from "notistack"; -import { useState } from "react"; -import useSWR from "swr"; - -import { SnackbarText } from "@/components/general/SnackbarText"; -import { fetcherGet, fetcherTrigger } from "@/utils/fetcher"; - -interface IRelease { - announcedAt: string | null; - embargoFrom: string; - id: number; - releaseAt: string; -} - -// Shift release date (#869): shifts on or after "From" stay hidden from -// volunteers (admins still see them) until "Opens". Pacific time. -export const ShiftRelease = () => { - const { data, mutate } = useSWR( - "/api/shift-release", - fetcherGet - ); - const { enqueueSnackbar } = useSnackbar(); - const [embargoFrom, setEmbargoFrom] = useState(""); - const [releaseAt, setReleaseAt] = useState(""); - - const send = async (method: string, body?: object, query = "") => { - try { - await fetcherTrigger(`/api/shift-release${query}`, { - arg: { body, method }, - }); - mutate(); - return true; - } catch (error) { - enqueueSnackbar( - - {(error as Error).message} - , - { persist: true, variant: "error" } - ); - return false; - } - }; - - return ( - - - Shift release - - - Volunteers can't see or sign up for shifts on or after the first date - until the release time (Pacific). Admins see them early. Meetings - aren't affected. At release, an announcement goes to Discord and the - mailing list. - - {data?.map((r) => ( - - - Shifts from {r.embargoFrom} open{" "} - {r.releaseAt.slice(0, 16)} - {r.announcedAt ? " (announced)" : ""} - - - - ))} - - setEmbargoFrom(e.target.value)} - slotProps={{ inputLabel: { shrink: true } }} - size="small" - type="date" - value={embargoFrom} - /> - setReleaseAt(e.target.value)} - slotProps={{ inputLabel: { shrink: true } }} - size="small" - type="datetime-local" - value={releaseAt} - /> - - - - ); -}; diff --git a/client/src/app/publishing/Publishing.tsx b/client/src/app/publishing/Publishing.tsx new file mode 100644 index 00000000..94dab8a7 --- /dev/null +++ b/client/src/app/publishing/Publishing.tsx @@ -0,0 +1,226 @@ +"use client"; + +import { + Box, + Button, + Container, + MenuItem, + Stack, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, + Typography, +} from "@mui/material"; +import { useTheme } from "@mui/material/styles"; +import Link from "next/link"; +import { useSnackbar } from "notistack"; +import { useState } from "react"; +import useSWR from "swr"; + +import { SnackbarText } from "@/components/general/SnackbarText"; +import { Hero } from "@/components/layout/Hero"; +import type { IForm } from "@/lib/forms"; +import { fetcherGet, fetcherTrigger } from "@/utils/fetcher"; + +interface IWindow { + announcedAt: string | null; + closeAt: string | null; + embargoFrom: string; + id: number; + releaseAt: string; + shiftName: string | null; + shiftNameId: number | null; +} + +const when = (t: string | null) => (t ? t.slice(0, 16) : "—"); + +// Publishing (#869, Mew 2026-11-29 option A): every dated open / close in one +// place. Shift windows hide shifts from volunteers before they open and after +// they close (admins still see them); forms are listed with their own dates. +export const Publishing = () => { + const theme = useTheme(); + const { data, mutate } = useSWR("/api/shift-release", fetcherGet); + const { data: types } = useSWR<{ id: number; name: string }[]>( + "/api/shifts/types", + fetcherGet + ); + const { data: forms } = useSWR("/api/forms?all=1", fetcherGet); + const { enqueueSnackbar } = useSnackbar(); + const [embargoFrom, setEmbargoFrom] = useState(""); + const [shiftNameId, setShiftNameId] = useState(""); + const [releaseAt, setReleaseAt] = useState(""); + const [closeAt, setCloseAt] = useState(""); + + const send = async (method: string, body?: object, query = "") => { + try { + await fetcherTrigger(`/api/shift-release${query}`, { + arg: { body, method }, + }); + mutate(); + return true; + } catch (error) { + enqueueSnackbar( + + {(error as Error).message} + , + { persist: true, variant: "error" } + ); + return false; + } + }; + + return ( + <> + + + + + Shifts + + + Volunteers can't see or sign up for the shifts a window covers + before it opens or after it closes (Pacific). Admins always see + them. "All on-playa shifts" leaves meetings alone; pick a + shift type to cover just that type. When a window opens, an + announcement goes to Discord and the mailing list. + + + + + Shifts + Dated from + Opens + Closes + + + + + {data?.map((r) => ( + + {r.shiftName ?? "All on-playa shifts"} + {r.embargoFrom} + + {when(r.releaseAt)} + {r.announcedAt ? " (announced)" : ""} + + {when(r.closeAt)} + + + + + ))} + +
+ + setShiftNameId(e.target.value)} + select + size="small" + sx={{ minWidth: 220 }} + value={shiftNameId} + > + All on-playa shifts + {(types ?? []).map((t) => ( + + {t.name} + + ))} + + setEmbargoFrom(e.target.value)} + slotProps={{ inputLabel: { shrink: true } }} + size="small" + type="date" + value={embargoFrom} + /> + setReleaseAt(e.target.value)} + slotProps={{ inputLabel: { shrink: true } }} + size="small" + type="datetime-local" + value={releaseAt} + /> + setCloseAt(e.target.value)} + slotProps={{ inputLabel: { shrink: true } }} + size="small" + type="datetime-local" + value={closeAt} + /> + + +
+ + + + Forms + + + Set on each form's edit page. Blank = no limit. + + + + + Form + Status + Opens + Closes + + + + {forms?.map((f) => ( + + + {f.title} + + {f.status} + {when(f.opensAt)} + {when(f.closesAt)} + + ))} + +
+
+
+ + ); +}; diff --git a/client/src/app/publishing/page.tsx b/client/src/app/publishing/page.tsx new file mode 100644 index 00000000..8146ac93 --- /dev/null +++ b/client/src/app/publishing/page.tsx @@ -0,0 +1,14 @@ +import { Publishing } from "@/app/publishing/Publishing"; +import { AuthGate } from "@/components/general/AuthGate"; +import { ACCOUNT_TYPE_SUPER_ADMIN } from "@/constants"; + +export const metadata = { + title: "Census | Publishing", +}; +const PublishingPage = () => ( + + + +); + +export default PublishingPage; diff --git a/client/src/components/api/shiftAddRules.ts b/client/src/components/api/shiftAddRules.ts index c7e1e323..bc7a3ce0 100644 --- a/client/src/components/api/shiftAddRules.ts +++ b/client/src/components/api/shiftAddRules.ts @@ -4,7 +4,7 @@ import type { Pool, PoolConnection } from "mysql2/promise"; import { CHECK_IN_BEFORE_HOURS } from "@/constants"; import { isAdmin } from "@/lib/authz"; import { hiddenFromSql } from "@/lib/exclusions"; -import { EMBARGOED_UNTIL_SQL } from "@/lib/shiftRelease"; +import { EMBARGOED_UNTIL_SQL, PUBLISH_CLOSED_SQL } from "@/lib/shiftRelease"; // The ONE copy of the "can this volunteer take this position" rules (C-863 A2). // POST /api/shifts/[timeId]/volunteers runs it inside its capacity lock, and @@ -26,7 +26,8 @@ export interface IShiftAddBlocker { | "time-conflict" | "max-per-volunteer" | "min-csp" - | "embargoed"; + | "embargoed" + | "publish-closed"; message: string; } export interface IShiftAddCheck { @@ -112,7 +113,8 @@ export async function checkShiftAdd( (CONVERT_TZ(NOW(), 'UTC', 'America/Los_Angeles') < DATE_SUB(st.start_time, INTERVAL ? HOUR)) AS is_future, ${hiddenFromSql("?")} AS is_hidden, - ${EMBARGOED_UNTIL_SQL} AS embargoed_until + ${EMBARGOED_UNTIL_SQL} AS embargoed_until, + ${PUBLISH_CLOSED_SQL} AS publish_closed FROM op_shift_time_position stp JOIN op_shift_times st ON st.shift_times_id = stp.shift_times_id @@ -182,6 +184,12 @@ export async function checkShiftAdd( message: `These shifts open for sign-up on ${String(position.embargoed_until).slice(0, 16)} (Pacific).`, }); } + if (position.publish_closed) { + findings.push({ + code: "publish-closed", + message: "Sign-up for these shifts has closed.", + }); + } if (position.missing_role) { findings.push({ code: "role-required", diff --git a/client/src/components/layout/Footer.tsx b/client/src/components/layout/Footer.tsx index 4bfcd73f..31e0a4d1 100644 --- a/client/src/components/layout/Footer.tsx +++ b/client/src/components/layout/Footer.tsx @@ -255,7 +255,7 @@ export const Footer = () => { color: theme.palette.common.white, }} > - 2027.G.00899.C + 2027.G.00900.C diff --git a/client/src/components/layout/pageList.tsx b/client/src/components/layout/pageList.tsx index eaad2257..92f6c3ec 100644 --- a/client/src/components/layout/pageList.tsx +++ b/client/src/components/layout/pageList.tsx @@ -2,6 +2,7 @@ import { Assignment as AssignmentIcon, BarChart as BarChartIcon, CalendarMonth as CalendarMonthIcon, + EventAvailable as EventAvailableIcon, ConfirmationNumber as ConfirmationNumberIcon, Email as EmailIcon, EventNote as EventNoteIcon, @@ -89,6 +90,12 @@ export const pageListSuperAdmin = [ label: "Dates", path: "/dates", }, + { + // shift + form open/close windows (#869) + icon: , + label: "Publishing", + path: "/publishing", + }, { // shift-email text (#795) icon: , diff --git a/client/src/lib/shiftRelease.ts b/client/src/lib/shiftRelease.ts index 5b33c45d..cdcf3319 100644 --- a/client/src/lib/shiftRelease.ts +++ b/client/src/lib/shiftRelease.ts @@ -7,15 +7,23 @@ import { actor } from "@/lib/actor"; // Shift release date (#869). Times are Pacific wall clock; the DB clock is UTC. const NOW_PT = "CONVERT_TZ(NOW(), 'UTC', 'America/Los_Angeles')"; -// For a shift row (aliases: st = op_shift_times, sn = op_shift_name): the Pacific -// time it opens if it's still embargoed, else NULL. Off-playa types are exempt. +// Publishing windows (#869, Mew 2026-11-29 option A). For a shift row +// (aliases: st = op_shift_times, sn = op_shift_name), the windows covering it: +// all on-playa shifts from embargo_from, or one shift type (off-playa too). +const COVERS = `(r.shift_name_id = sn.shift_name_id + OR (r.shift_name_id IS NULL AND sn.off_playa = false)) + AND DATE(st.start_time) >= r.embargo_from`; + +// The Pacific time it opens if a window hasn't opened yet, else NULL. // Used by /api/shifts (hide from non-admins) and checkShiftAdd (refuse // non-admin sign-ups), so a direct link or Pumpkin can't get around it. export const EMBARGOED_UNTIL_SQL = `(SELECT MAX(r.release_at) FROM op_shift_release r - WHERE sn.off_playa = false - AND DATE(st.start_time) >= r.embargo_from - AND r.release_at > ${NOW_PT})`; + WHERE ${COVERS} AND r.release_at > ${NOW_PT})`; + +// 1 if a window covering it has closed ("shift closes it is hidden"), else 0. +export const PUBLISH_CLOSED_SQL = `EXISTS (SELECT 1 FROM op_shift_release r + WHERE ${COVERS} AND r.close_at <= ${NOW_PT})`; const APP_BASE_URL = process.env.APP_BASE_URL ?? "https://volunteers.census.burningman.org"; @@ -30,20 +38,22 @@ const LIST_EMAIL = process.env.SHIFT_RELEASE_LIST_EMAIL?.trim() || null; // doesn't announce it. async function announceDueReleases() { const [due] = await pool.query( - `SELECT release_id, YEAR(embargo_from) AS year - FROM op_shift_release + `SELECT r.release_id, YEAR(r.embargo_from) AS year, sn.shift_name + FROM op_shift_release r + LEFT JOIN op_shift_name sn ON sn.shift_name_id = r.shift_name_id WHERE announced_at IS NULL AND release_at <= ${NOW_PT} AND release_at > ${NOW_PT} - INTERVAL 1 DAY` ); - for (const { release_id: id, year } of due) { + for (const { release_id: id, shift_name: name, year } of due) { const [claim] = await pool.query( `UPDATE op_shift_release SET changed_by = ${actor()}, announced_at = NOW() WHERE release_id = ? AND announced_at IS NULL`, [id] ); if (claim.affectedRows !== 1) continue; // ponytail: copy awaits Chipper's review (#869) - const text = `${year} Black Rock City Census volunteer shifts are open for sign-up: ${APP_BASE_URL}/shifts`; + const what = name ? `${name} shifts` : "volunteer shifts"; + const text = `${year} Black Rock City Census ${what} are open for sign-up: ${APP_BASE_URL}/shifts`; if (DISCORD_WEBHOOK_URL) { try { await fetch(DISCORD_WEBHOOK_URL, { @@ -60,7 +70,7 @@ async function announceDueReleases() { await enqueueEmail({ bodyText: text, category: "shift-release", - subject: `${year} Census volunteer shifts are open`, + subject: `${year} Census ${what} are open`, to: LIST_EMAIL, }); } catch (err) { diff --git a/client/src/pages/api/shift-release/index.ts b/client/src/pages/api/shift-release/index.ts index f1cb7143..2b4556db 100644 --- a/client/src/pages/api/shift-release/index.ts +++ b/client/src/pages/api/shift-release/index.ts @@ -6,22 +6,29 @@ import { pool } from "lib/database"; import { actor } from "@/lib/actor"; // /api/shift-release (#869): the release rows behind the shift embargo. -// GET → [{ id, embargoFrom, releaseAt, announcedAt }] -// POST { embargoFrom: "YYYY-MM-DD", releaseAt: "YYYY-MM-DDTHH:mm" } (Pacific) -// DELETE ?id=… removes one. Edit = delete + add; one row per season. +// GET → [{ id, embargoFrom, shiftNameId, shiftName, releaseAt, closeAt, announcedAt }] +// POST { embargoFrom: "YYYY-MM-DD", releaseAt: "YYYY-MM-DDTHH:mm", +// closeAt?: "YYYY-MM-DDTHH:mm" | null, shiftNameId?: number | null } (Pacific) +// DELETE ?id=… removes one. Edit = delete + add. const shiftRelease = async (req: NextApiRequest, res: NextApiResponse) => { switch (req.method) { case "GET": { const [rows] = await pool.query( - `SELECT release_id, embargo_from, release_at, announced_at - FROM op_shift_release ORDER BY release_at DESC` + `SELECT r.release_id, r.embargo_from, r.shift_name_id, sn.shift_name, + r.release_at, r.close_at, r.announced_at + FROM op_shift_release r + LEFT JOIN op_shift_name sn ON sn.shift_name_id = r.shift_name_id + ORDER BY r.release_at DESC` ); return res.status(200).json( rows.map((r) => ({ announcedAt: r.announced_at, + closeAt: r.close_at, embargoFrom: r.embargo_from, id: r.release_id, releaseAt: r.release_at, + shiftName: r.shift_name, + shiftNameId: r.shift_name_id, })) ); } @@ -32,21 +39,38 @@ const shiftRelease = async (req: NextApiRequest, res: NextApiResponse) => { } catch { return res.status(400).json({ statusCode: 400, message: "Bad JSON" }); } - const { embargoFrom, releaseAt } = body; + const { closeAt, embargoFrom, releaseAt, shiftNameId } = body; + const DT = /^\d{4}-\d{2}-\d{2}[T ]([01]\d|2[0-3]):[0-5]\d$/; if ( typeof embargoFrom !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(embargoFrom) || typeof releaseAt !== "string" || - !/^\d{4}-\d{2}-\d{2}[T ]([01]\d|2[0-3]):[0-5]\d$/.test(releaseAt) + !DT.test(releaseAt) || + (closeAt != null && + (typeof closeAt !== "string" || !DT.test(closeAt))) || + (shiftNameId != null && !Number.isSafeInteger(shiftNameId)) ) { return res.status(400).json({ statusCode: 400, - message: "Need embargoFrom YYYY-MM-DD and releaseAt YYYY-MM-DD HH:mm.", + message: + "Need embargoFrom YYYY-MM-DD, releaseAt (and optional closeAt) YYYY-MM-DD HH:mm.", }); } + const toDb = (t: string) => `${t.replace("T", " ")}:00`; + if (closeAt && toDb(closeAt as string) <= toDb(releaseAt)) + return res + .status(400) + .json({ statusCode: 400, message: "Close after it opens." }); await pool.query( - `INSERT INTO op_shift_release (changed_by, embargo_from, release_at) VALUES (${actor()}, ?, ?)`, - [embargoFrom, `${releaseAt.replace("T", " ")}:00`] + `INSERT INTO op_shift_release + (changed_by, embargo_from, shift_name_id, release_at, close_at) + VALUES (${actor()}, ?, ?, ?, ?)`, + [ + embargoFrom, + shiftNameId ?? null, + toDb(releaseAt), + closeAt ? toDb(closeAt as string) : null, + ] ); return res.status(201).json({ statusCode: 201, message: "Created" }); } diff --git a/client/src/pages/api/shifts/index.ts b/client/src/pages/api/shifts/index.ts index ad305fe2..42ee7d02 100644 --- a/client/src/pages/api/shifts/index.ts +++ b/client/src/pages/api/shifts/index.ts @@ -4,7 +4,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { isAdmin } from "@/lib/authz"; import { hiddenFilterSql } from "@/lib/exclusions"; import { readSessionFromRequest } from "@/lib/session"; -import { EMBARGOED_UNTIL_SQL } from "@/lib/shiftRelease"; +import { EMBARGOED_UNTIL_SQL, PUBLISH_CLOSED_SQL } from "@/lib/shiftRelease"; import { getShiftList } from "@/utils/getShiftList"; import { pool } from "lib/database"; @@ -21,7 +21,7 @@ const shifts = async (req: NextApiRequest, res: NextApiResponse) => { const embargoFilter = session && (await isAdmin(session.shiftboardId)) ? "" - : `AND ${EMBARGOED_UNTIL_SQL} IS NULL`; + : `AND ${EMBARGOED_UNTIL_SQL} IS NULL AND NOT ${PUBLISH_CLOSED_SQL}`; const hiddenFilter = hiddenFilterSql(session?.shiftboardId); // get all training shifts diff --git a/migrations/036_shift_publishing.sql b/migrations/036_shift_publishing.sql new file mode 100644 index 00000000..acb0f83a --- /dev/null +++ b/migrations/036_shift_publishing.sql @@ -0,0 +1,10 @@ +-- Publishing windows (Mew 2026-11-29, option A): op_shift_release rows become +-- dated windows on one Publishing page. A window covers every on-playa shift +-- on or after embargo_from (shift_name_id NULL, as before) or one shift type +-- (any type, off-playa included). Before release_at and from close_at on, +-- volunteers can't see or sign up for those shifts ("shift closes it is +-- hidden"); admins still can. +SET @@system_versioning_alter_history = KEEP; +ALTER TABLE op_shift_release + ADD COLUMN IF NOT EXISTS shift_name_id BIGINT NULL AFTER embargo_from, + ADD COLUMN IF NOT EXISTS close_at DATETIME NULL AFTER release_at;