-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: added initial migration script
Closes #80
- Loading branch information
1 parent
97eac09
commit c88134c
Showing
7 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/database/migrations/20230812121853-create_initial_settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
async up(db) { | ||
await db.collection('settings').deleteMany({}); | ||
await db.collection('settings').insertOne({ | ||
submission_deadline: new Date('2023-09-21T12:00:00.000Z'), | ||
registration_deadline: new Date('2023-09-14T12:00:00.000Z'), | ||
created_at: new Date(), | ||
updated_at: new Date(), | ||
__v: 0 | ||
}); | ||
}, | ||
|
||
async down(db) { | ||
await db.collection('settings').deleteMany({}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Joi } from 'celebrate'; | ||
|
||
export const updateSettingsSchema = Joi.object.keys({ | ||
export const updateSettingsSchema = Joi.object({ | ||
submission_deadline: Joi.date().allow(null), | ||
registration_deadline: Joi.date().allow(null) | ||
}); |