feat: remove archived status from recordings, deletions are now immediate
All checks were successful
Build and Push Backend Image / build (push) Successful in 45s
Build and Push Frontend Image / build (push) Successful in 4m3s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 11:42:13 +01:00
parent 754a236e51
commit fde0d63271
5 changed files with 18 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ import {
import { users } from "./users";
import { videos } from "./videos";
export const recordingStatusEnum = pgEnum("recording_status", ["draft", "published", "archived"]);
export const recordingStatusEnum = pgEnum("recording_status", ["draft", "published"]);
export const recordings = pgTable(
"recordings",

View File

@@ -2,7 +2,7 @@ import { GraphQLError } from "graphql";
import { builder } from "../builder";
import { RecordingType, AdminRecordingListType } from "../types/index";
import { recordings, recording_plays, users } from "../../db/schema/index";
import { eq, and, desc, ne, ilike, count } from "drizzle-orm";
import { eq, and, desc, ilike, count } from "drizzle-orm";
import { slugify } from "../../lib/slugify";
import { awardPoints, checkAchievements } from "../../lib/gamification";
import { requireAdmin } from "../../lib/acl";
@@ -22,7 +22,6 @@ builder.queryField("recordings", (t) =>
const conditions = [eq(recordings.user_id, ctx.currentUser.id)];
if (args.status) conditions.push(eq(recordings.status, args.status as any));
else conditions.push(ne(recordings.status, "archived" as any));
if (args.linkedVideoId) conditions.push(eq(recordings.linked_video, args.linkedVideoId));
const limit = args.limit || 50;

View File

@@ -0,0 +1,8 @@
-- Update any archived recordings to draft before removing the status
UPDATE "recordings" SET "status" = 'draft' WHERE "status" = 'archived';--> statement-breakpoint
-- Recreate enum without 'archived'
ALTER TYPE "public"."recording_status" RENAME TO "recording_status_old";--> statement-breakpoint
CREATE TYPE "public"."recording_status" AS ENUM('draft', 'published');--> statement-breakpoint
ALTER TABLE "recordings" ALTER COLUMN "status" TYPE "public"."recording_status" USING "status"::text::"public"."recording_status";--> statement-breakpoint
DROP TYPE "public"."recording_status_old";

View File

@@ -15,6 +15,13 @@
"when": 1772645674514,
"tag": "0001_is_admin",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1741337600000,
"tag": "0002_remove_archived_recording_status",
"breakpoints": true
}
]
}