1- import { Migration } from "../umzug" ;
1+ // import { Migration } from "../umzug";
2+ import { QueryInterface } from "sequelize" ;
23
34const OLD_TASKS_TABLE = "activities" ;
45const NEW_TASKS_TABLE = "tasks" ;
@@ -10,63 +11,55 @@ const NEW_ID_COL = "task_template_id";
1011const OLD_TASK_NAME = "activity_name" ;
1112const NEW_TASK_NAME = "task_name" ;
1213
13- export const up : Migration = async ( { context : sequelize } ) => {
14- const queryinterface = sequelize . getQueryInterface ( ) ;
14+ module . exports = {
15+ up : async ( queryInterface : QueryInterface , Sequelize : any ) => {
1516
16- await queryinterface . renameTable (
17+ await queryInterface . renameTable (
1718 // rename activities table to tasks
1819 OLD_TASKS_TABLE ,
1920 NEW_TASKS_TABLE ,
2021 ) ;
2122
22- await queryinterface . renameTable (
23+ await queryInterface . renameTable (
2324 // rename activitytypes to task templates
2425 OLD_TASKTEMPLATES_TABLE ,
2526 NEW_TASKTEMPLATES_TABLE ,
2627 ) ;
2728
28- await queryinterface . renameColumn (
29+ await queryInterface . renameColumn (
2930 // rename activity type id to task type id
3031 NEW_TASKS_TABLE ,
3132 OLD_ID_COL ,
3233 NEW_ID_COL ,
3334 ) ;
3435
35- await queryinterface . renameColumn (
36+ await queryInterface . renameColumn (
3637 // rename activity name to task name
3738 NEW_TASKTEMPLATES_TABLE ,
3839 OLD_TASK_NAME ,
3940 NEW_TASK_NAME ,
4041 ) ;
41- } ;
42-
43- export const down : Migration = async ( { context : sequelize } ) => {
44- // reverts migration
45- const queryinterface = sequelize . getQueryInterface ( ) ;
46-
47- await queryinterface . renameColumn (
48- // rename task name to activity name
49- NEW_TASKTEMPLATES_TABLE ,
50- NEW_TASK_NAME ,
51- OLD_TASK_NAME ,
52- ) ;
5342
54- await queryinterface . renameColumn (
43+ } ,
44+ down : async ( queryInterface : QueryInterface , Sequelize : any ) => {
45+
46+ await queryInterface . renameColumn (
5547 // rename taskid back to activityid col
5648 NEW_TASKS_TABLE ,
5749 NEW_ID_COL ,
5850 OLD_ID_COL ,
5951 ) ;
6052
61- await queryinterface . renameTable (
53+ await queryInterface . renameTable (
6254 // rename tasktemplate table back to activity types
6355 NEW_TASKTEMPLATES_TABLE ,
6456 OLD_TASKTEMPLATES_TABLE ,
6557 ) ;
6658
67- await queryinterface . renameTable (
59+ await queryInterface . renameTable (
6860 // rename tasks table back to activites
6961 NEW_TASKS_TABLE ,
7062 OLD_TASKS_TABLE ,
7163 ) ;
64+ } ,
7265} ;
0 commit comments