diff --git a/migrations/20260806000000-deprecate-announcements.mjs b/migrations/20260806000000-deprecate-announcements.mjs new file mode 100644 index 00000000..09146524 --- /dev/null +++ b/migrations/20260806000000-deprecate-announcements.mjs @@ -0,0 +1,34 @@ +export const up = async (db) => { + await db.collection('announcements').drop(); +}; + +export const down = async (db) => { + await db.createCollection('announcements', { + validator: { + $jsonSchema: { + bsonType: 'object', + title: 'Announcements Object Validation', + required: ['title', 'description', 'time'], + properties: { + _id: { + bsonType: 'objectId', + description: '_id must be an ObjectId', + }, + title: { + bsonType: 'string', + description: 'title must be a string', + }, + description: { + bsonType: 'string', + description: 'description must be a string', + }, + time: { + bsonType: 'date', + description: 'time must be a date.', + }, + }, + additionalProperties: false, + }, + }, + }); +};