import type { Kysely } from "kysely"; import { execDdl, oneOf } from "../src/migration-helpers.ts"; // M-Team 字幕沿用字幕资产与可撤销历史,只扩展来源,不保存下载签名。 // biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型 export async function up(db: Kysely): Promise { await execDdl( db, `alter table subtitle_write drop constraint subtitle_write_source_check; alter table subtitle_write add constraint subtitle_write_source_check ${oneOf("source", ["upload", "subhd", "zimuku", "mteam"])};`, ); } // biome-ignore lint/suspicious/noExplicitAny: 同上 export async function down(db: Kysely): Promise { // 有新来源的历史时拒绝回退,不删除记录或改写其来源。 await execDdl( db, `alter table subtitle_write drop constraint subtitle_write_source_check; alter table subtitle_write add constraint subtitle_write_source_check ${oneOf("source", ["upload", "subhd", "zimuku"])};`, ); }