From 06f5f72e6ecf8e3729b64672c3ef3cb761485b78 Mon Sep 17 00:00:00 2001 From: Haylie Tan Date: Wed, 5 Aug 2026 20:28:09 -0700 Subject: [PATCH 1/4] chore: add migration to deprecate announcements collection --- ...20260806000000-deprecate-announcements.mjs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 migrations/20260806000000-deprecate-announcements.mjs diff --git a/migrations/20260806000000-deprecate-announcements.mjs b/migrations/20260806000000-deprecate-announcements.mjs new file mode 100644 index 00000000..fb48fd03 --- /dev/null +++ b/migrations/20260806000000-deprecate-announcements.mjs @@ -0,0 +1,40 @@ +export const up = async (db) => { + const collectionExists = await db + .listCollections({ name: "announcements" }, { nameOnly: true }) + .hasNext(); + + if (collectionExists) { + 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, + }, + }, + }); +}; From 4ae3edcbace809c58129ee513fa5841ac14a2de7 Mon Sep 17 00:00:00 2001 From: Haylie Tan Date: Thu, 6 Aug 2026 16:43:57 -0700 Subject: [PATCH 2/4] linting --- ...20260806000000-deprecate-announcements.mjs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/migrations/20260806000000-deprecate-announcements.mjs b/migrations/20260806000000-deprecate-announcements.mjs index fb48fd03..690942c9 100644 --- a/migrations/20260806000000-deprecate-announcements.mjs +++ b/migrations/20260806000000-deprecate-announcements.mjs @@ -4,33 +4,33 @@ export const up = async (db) => { .hasNext(); if (collectionExists) { - await db.collection("announcements").drop(); + await db.collection('announcements').drop(); } }; export const down = async (db) => { - await db.createCollection("announcements", { + await db.createCollection('announcements', { validator: { $jsonSchema: { - bsonType: "object", - title: "Announcements Object Validation", - required: ["title", "description", "time"], + bsonType: 'object', + title: 'Announcements Object Validation', + required: ['title', 'description', 'time'], properties: { _id: { - bsonType: "objectId", - description: "_id must be an ObjectId", + bsonType: 'objectId', + description: '_id must be an ObjectId', }, title: { - bsonType: "string", - description: "title must be a string", + bsonType: 'string', + description: 'title must be a string', }, description: { - bsonType: "string", - description: "description must be a string", + bsonType: 'string', + description: 'description must be a string', }, time: { - bsonType: "date", - description: "time must be a date.", + bsonType: 'date', + description: 'time must be a date.', }, }, additionalProperties: false, From 027c57702df0c2a48294ec7e4dfb75d3c7007d05 Mon Sep 17 00:00:00 2001 From: Haylie Tan Date: Thu, 6 Aug 2026 16:44:12 -0700 Subject: [PATCH 3/4] Update 20260806000000-deprecate-announcements.mjs --- migrations/20260806000000-deprecate-announcements.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/20260806000000-deprecate-announcements.mjs b/migrations/20260806000000-deprecate-announcements.mjs index 690942c9..72341232 100644 --- a/migrations/20260806000000-deprecate-announcements.mjs +++ b/migrations/20260806000000-deprecate-announcements.mjs @@ -1,6 +1,6 @@ export const up = async (db) => { const collectionExists = await db - .listCollections({ name: "announcements" }, { nameOnly: true }) + .listCollections({ name: 'announcements' }, { nameOnly: true }) .hasNext(); if (collectionExists) { From 53cf16b1333a596d58ae9ffdca05ea3b92df196b Mon Sep 17 00:00:00 2001 From: Haylie Tan Date: Thu, 6 Aug 2026 16:46:24 -0700 Subject: [PATCH 4/4] Update 20260806000000-deprecate-announcements.mjs --- migrations/20260806000000-deprecate-announcements.mjs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/migrations/20260806000000-deprecate-announcements.mjs b/migrations/20260806000000-deprecate-announcements.mjs index 72341232..09146524 100644 --- a/migrations/20260806000000-deprecate-announcements.mjs +++ b/migrations/20260806000000-deprecate-announcements.mjs @@ -1,11 +1,5 @@ export const up = async (db) => { - const collectionExists = await db - .listCollections({ name: 'announcements' }, { nameOnly: true }) - .hasNext(); - - if (collectionExists) { - await db.collection('announcements').drop(); - } + await db.collection('announcements').drop(); }; export const down = async (db) => {