-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Visualisations): Correct LAST_1_YEARS typo in DB (#1401)
- Loading branch information
1 parent
406a5dd
commit 3e5a83e
Showing
3 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import logger from 'lib/logger'; | ||
import Visualisation from 'lib/models/visualisation'; | ||
|
||
const OLD_VALUE = 'LAST_1_YEARS'; | ||
const NEW_VALUE = 'LAST_2_YEARS'; | ||
|
||
export const back = async () => { | ||
try { | ||
await Visualisation.updateMany({ previewPeriod: NEW_VALUE }, { $set: { previewPeriod: OLD_VALUE } }); | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; | ||
|
||
export const fix = async () => { | ||
try { | ||
await Visualisation.updateMany({ previewPeriod: OLD_VALUE }, { $set: { previewPeriod: NEW_VALUE } }); | ||
} catch (error) { | ||
logger.error(error); | ||
} | ||
}; | ||
|
||
export default fix; |
11 changes: 11 additions & 0 deletions
11
cli/src/commands/v2-migrations/20190627000000_fix_typo_last_1_years.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,11 @@ | ||
import { fix, back } from '../fixTypoLast1Years'; | ||
|
||
const up = async () => { | ||
await fix(); | ||
}; | ||
|
||
const down = async () => { | ||
await back(); | ||
}; | ||
|
||
export default { up, down }; |
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