- POST /acquisition-plans: manual submit via download.plan -> download.submit
(same authorization/audit/idempotency path as the agent), slotId or entityId
- read-only /media-assets, /asset-locations, /asset-unit-coverage, /path-bindings,
/reconcile-runs, /server-mappings, /artifacts, GET /title-aliases/{id};
unimplemented write endpoints removed from api.ts; registry test now checks both directions
- candidate evaluation upsert per (slot, source_release) + migration 0022 dedupe/unique index
- organization records expose downloadTaskId (+ list filter); inventory adds
subscribed/candidateReasons; feed sources expose derived possibleGap
- GET /events?after=&limit= JSON replay page for API key callers (same sse_event table)
- preference tag revision history from audit_event; subscriptions/identities/aliases
lists carry mediaEntityTitle; subscription q/mediaKind search; slot subscriptionId
filter + currentAsset summary; policy preview samples carry title/reasons
- DecisionSummary, IdentityRevisionList, ReleaseIdentityResult, PolicyPreviewSummary exported from contracts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import type { Kysely } from "kysely";
|
|
import { execDdl } from "../src/migration-helpers.ts";
|
|
|
|
// W4-A 候选评估记录去重:同一 (acquisition_slot, source_release) 只保留最新一条(artifact title=candidate_evaluation)。
|
|
// 先清掉历史重复(保留 updated_at 最新的一条),再加唯一表达式索引,写入端按该键 upsert。
|
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
|
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
await execDdl(
|
|
db,
|
|
`
|
|
delete from artifact a
|
|
using artifact b
|
|
where a.title = 'candidate_evaluation' and b.title = 'candidate_evaluation'
|
|
and a.subject_type = 'acquisition_slot' and b.subject_type = 'acquisition_slot'
|
|
and a.subject_id = b.subject_id
|
|
and (a.content->>'sourceReleaseId') = (b.content->>'sourceReleaseId')
|
|
and (a.updated_at, a.id) < (b.updated_at, b.id);
|
|
create unique index artifact_candidate_slot_release
|
|
on artifact (subject_id, (content->>'sourceReleaseId'))
|
|
where title = 'candidate_evaluation' and subject_type = 'acquisition_slot';
|
|
`,
|
|
);
|
|
}
|
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: 同上
|
|
export async function down(db: Kysely<any>): Promise<void> {
|
|
await execDdl(db, "drop index if exists artifact_candidate_slot_release;");
|
|
}
|