From ea1867ae824dc9ed9ea3af05d9e3a5fe180e6b8c Mon Sep 17 00:00:00 2001 From: Jinho-Choi123 Date: Sun, 5 May 2024 21:30:03 +0900 Subject: [PATCH] migrate: add showBoard field to zabo schema --- .../1714912017538-add_showBoard_field.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 migrations/1714912017538-add_showBoard_field.js diff --git a/migrations/1714912017538-add_showBoard_field.js b/migrations/1714912017538-add_showBoard_field.js new file mode 100644 index 0000000..398747e --- /dev/null +++ b/migrations/1714912017538-add_showBoard_field.js @@ -0,0 +1,25 @@ +require ('@babel/register'); +require ('../config/env'); + +const {Zabo} = require('../src/db'); + +/** + * Make any changes you need to make to the database here + */ +async function up () { + // Write migration here + // eslint-disable-next-line no-restricted-syntax + for await (const zabo of Zabo.find()) { + zabo.showBoard = false; + await zabo.save (); + } +} + +/** + * Make any changes that UNDO the up function side effects here (if possible) + */ +async function down () { + // Write migration here +} + +module.exports = { up, down };