Skip to content

Commit

Permalink
wip: migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Nov 7, 2024
1 parent 91d69ab commit 70228e2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions meteor/server/migration/X_X_X.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,41 @@ export const addSteps = addMigrationSteps(CURRENT_SYSTEM_VERSION, [
}
},
},

{
id: `add studio settings allowHold & allowPieceDirectPlay`,
canBeRunAutomatically: true,
validate: async () => {
const studios = await Studios.findFetchAsync({
$or: [
{ 'settings.allowHold': { $exists: false } },
{ 'settings.allowPieceDirectPlay': { $exists: false } },
],
})

if (studios.length > 0) {
return 'studios must have settings.allowHold and settings.allowPieceDirectPlay defined'
}

return false
},
migrate: async () => {
const studios = await Studios.findFetchAsync({
$or: [
{ 'settings.allowHold': { $exists: false } },
{ 'settings.allowPieceDirectPlay': { $exists: false } },
],
})

for (const studio of studios) {
// Populate the settings to be backwards compatible
await Studios.updateAsync(studio._id, {
$set: {
'settings.allowHold': true,
'settings.allowPieceDirectPlay': true,
},
})
}
},
},
])

0 comments on commit 70228e2

Please sign in to comment.