diff --git a/src/migrations/scripts/1716993738507-add-category-appointment-filter.ts b/src/migrations/scripts/1716993738507-add-category-appointment-filter.ts new file mode 100644 index 0000000000000000000000000000000000000000..9211b332706041e50a13ba264ffc6b008fd2b5ca --- /dev/null +++ b/src/migrations/scripts/1716993738507-add-category-appointment-filter.ts @@ -0,0 +1,32 @@ +import { getDb } from '../migrations-utils/db'; + +export const up = async () => { + try { + const db = await getDb(); + const newCategory = { + modules: [ + { + id: 'True', + name: 'hasUserWithAppointmentDN', + }, + ], + name: 'Demande de RDV', + theme: 'Pas de modale', + id: 'hasUserWithAppointmentDN', + }; + await db.collection('categories').insertOne(newCategory); + console.log(`Update done: New category 'hasUserWithAppointmentDN' added successfully.`); + } catch (error) { + console.error(`Error while creating the new category 'hasUserWithAppointmentDN':`, error); + } +}; + +export const down = async () => { + try { + const db = await getDb(); + await db.collection('categories').deleteOne({ id: 'hasUserWithAppointmentDN' }); + console.log(`Downgrade done: removed the 'hasUserWithAppointmentDN' category.`); + } catch (error) { + console.error(`Error while removing the 'hasUserWithAppointmentDN' category:`, error); + } +};