Skip to content

Commit 2bb6dae

Browse files
committed
feat: add migration to remove orphaned draft talks with invalid formats
1 parent 24237cb commit 2bb6dae

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

  • migrations/032-remove-orphaned-talks
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineMigration } from 'sanity/migrate'
2+
3+
const ORPHANED_TALK_IDS = [
4+
'718a8937-2bb1-4769-b6c1-666c18ac496d', // TBD
5+
'553967fa-9f83-4fd8-a59c-0f15a269767b', // Awesome presentation 2 (invalid format: workshop_4h)
6+
'eca71842-1b1e-4606-a07d-3c7f4a44f311', // Checkin
7+
'a963ff41-917d-4ec7-a9af-a68b88031241', // Lunch placeholder
8+
'9c47088e-e7cf-49c7-aaab-1815d43a4097', // Tapas and Drinks placeholder
9+
]
10+
11+
export default defineMigration({
12+
title: 'Remove orphaned draft talks',
13+
description:
14+
'Removes orphaned talk documents that are placeholders or have invalid formats, and are not referenced by any schedule.',
15+
documentTypes: ['talk'],
16+
17+
migrate: {
18+
document(doc) {
19+
if (ORPHANED_TALK_IDS.includes(doc._id)) {
20+
console.log(`Deleting orphaned talk "${doc.title}" (${doc._id})`)
21+
return [{ type: 'delete' as const, id: doc._id }]
22+
}
23+
return []
24+
},
25+
},
26+
})

0 commit comments

Comments
 (0)