File tree Expand file tree Collapse file tree
migrations/032-remove-orphaned-talks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } )
You can’t perform that action at this time.
0 commit comments