feat(集数映射): 作品季集结构字段(迁移 0075)、剧集组接口契约与按 TMDB 默认季集换算
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
5434ae8ee8
commit
3f6d8e410f
9 files changed
+271
-1
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import type { Kysely } from "kysely";
|
||||
import { execDdl } from "../src/migration-helpers.ts";
|
||||
|
||||
// 作品的季集结构(剧集组):null = TMDB 默认季;否则为 TMDB 剧集组 id(/tv/episode_group/{id}),季表与季 / 集单元按组生成。
|
||||
// 名称冗余存一份(界面显示不用再查 TMDB);选择时间与操作者(`<actor_type>:<actor_id>`)供审计与界面「谁改的」。
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(
|
||||
db,
|
||||
`
|
||||
alter table media_entity add column episode_group_id text;
|
||||
alter table media_entity add column episode_group_name text;
|
||||
alter table media_entity add column episode_group_set_at timestamptz;
|
||||
alter table media_entity add column episode_group_set_by text;
|
||||
`,
|
||||
);
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 同上
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(
|
||||
db,
|
||||
`
|
||||
alter table media_entity drop column if exists episode_group_set_by;
|
||||
alter table media_entity drop column if exists episode_group_set_at;
|
||||
alter table media_entity drop column if exists episode_group_name;
|
||||
alter table media_entity drop column if exists episode_group_id;
|
||||
`,
|
||||
);
|
||||
}
|
||||
@@ -952,6 +952,10 @@ export interface MediaEntityTable {
|
||||
created_at: GeneratedTimestamptz;
|
||||
updated_at: GeneratedTimestamptz;
|
||||
naming_override: Json | null;
|
||||
episode_group_id: string | null;
|
||||
episode_group_name: string | null;
|
||||
episode_group_set_at: Timestamptz | null;
|
||||
episode_group_set_by: string | null;
|
||||
}
|
||||
|
||||
export interface MediaServerInstanceTable {
|
||||
|
||||
Reference in new issue
Block a user