- 删除 docs/plan 下 00–18 的计划、评审、验收、发布记录与升级证据,docs/spikes 与 spikes 验证代码
(保留 spikes/movieclaw-src 本地克隆),以及 4 份一次性审查 / 调研;全部可在 ceb66f8 查到
- MP 对照移到 docs/porting/moviepilot-v3-comparison.md;经验教训改为 docs/plan/lessons.md(补第 25 条)
- docs/plan/README.md:文档放哪、当前状态、待办
- 引用改写:代码注释指向在维护的文档,其余注明已删除与 git 位置;清掉原有 6 个失效链接
- README 开头改为当前状态与入口;CHANGELOG 补齐 0.3.8–0.3.14 与工程变更
Co-Authored-By: Claude Opus 5.5 <[email protected]>
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import type { Kysely } from "kysely";
|
|
import { dropTables, entityTable, execDdl } from "../src/migration-helpers.ts";
|
|
|
|
// W5-A 文件管理(docs/runbook/files.md):
|
|
// - trash_item:删除进回收站的记录(原根/原相对路径/回收站内路径/到期时间/关联资产快照);
|
|
// 还原或清除后删行(历史留在 audit_event)。root_id 为文件管理的根 id(lib:<uuid> / dl:<uuid>:<n>)。
|
|
// - artifact_files_idem_key:文件管理写操作的幂等键(artifact title='files_idem',content.key)唯一。
|
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
|
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
await execDdl(
|
|
db,
|
|
`
|
|
${entityTable(
|
|
"trash_item",
|
|
`
|
|
root_id text not null,
|
|
library_root_id uuid references library_root (id) on delete set null,
|
|
root_host_path text not null,
|
|
original_path text not null,
|
|
trash_path text not null,
|
|
is_dir boolean not null default false,
|
|
size_bytes bigint not null default 0,
|
|
actor text,
|
|
deleted_at timestamptz not null default now(),
|
|
expires_at timestamptz not null,
|
|
asset_snapshot jsonb,
|
|
constraint trash_item_trash_path_key unique (trash_path)`,
|
|
)}
|
|
create index trash_item_expires_idx on trash_item (expires_at);
|
|
create index trash_item_root_idx on trash_item (root_id, deleted_at desc);
|
|
|
|
create unique index artifact_files_idem_key on artifact ((content->>'key')) where title = 'files_idem';
|
|
`,
|
|
);
|
|
}
|
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: 同上
|
|
export async function down(db: Kysely<any>): Promise<void> {
|
|
await execDdl(db, `drop index if exists artifact_files_idem_key;\n${dropTables(["trash_item"])}`);
|
|
}
|