Skip to content

Commit

Permalink
Update Sequelize to v6 (GladysAssistant#1085)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre-Gilles Leymarie <pierregilles.leymarie@gmail.com>
  • Loading branch information
2 people authored and Jean-Philippe Danrée committed Aug 27, 2021
1 parent 5d512ed commit 8afb962
Show file tree
Hide file tree
Showing 46 changed files with 208 additions and 164 deletions.
9 changes: 6 additions & 3 deletions server/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ module.exports = {
dialect: 'sqlite',
storage: process.env.SQLITE_FILE_PATH || './gladys-development.db',
logging: false,
operatorsAliases: false,
define: {
underscored: true,
freezeTableName: true,
createdAt: 'created_at', // Hack https://github.com/sequelize/sequelize/issues/11225
updatedAt: 'updated_at',
},
retry: {
match: [/SQLITE_BUSY/],
Expand All @@ -21,11 +22,12 @@ module.exports = {
test: {
dialect: 'sqlite',
storage: process.env.SQLITE_FILE_PATH || ':memory:',
operatorsAliases: false,
logging: false,
define: {
underscored: true,
freezeTableName: true,
createdAt: 'created_at', // Hack https://github.com/sequelize/sequelize/issues/11225
updatedAt: 'updated_at',
},
retry: {
match: [/SQLITE_BUSY/],
Expand All @@ -40,11 +42,12 @@ module.exports = {
production: {
dialect: 'sqlite',
storage: process.env.SQLITE_FILE_PATH || './gladys-production.db',
operatorsAliases: false,
logging: false,
define: {
underscored: true,
freezeTableName: true,
createdAt: 'created_at', // Hack https://github.com/sequelize/sequelize/issues/11225
updatedAt: 'updated_at',
},
retry: {
match: [/SQLITE_BUSY/],
Expand Down
2 changes: 1 addition & 1 deletion server/migrations/20190205063641-create-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ module.exports = {

await queryInterface.addIndex('t_user', ['role']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_user'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_user'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190206102938-create-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ module.exports = {
await queryInterface.addIndex('t_location', ['user_id']);
await queryInterface.addIndex('t_location', ['created_at']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_location'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_location'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190206114851-create-house.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_house'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_house'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211033038-create-life-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ module.exports = {
await queryInterface.addIndex('t_life_event', ['house_id']);
await queryInterface.addIndex('t_life_event', ['type']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_life_event'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_life_event'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211034727-create-room.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ module.exports = {

await queryInterface.addIndex('t_room', ['house_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_room'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_room'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211035101-create-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ module.exports = {
await queryInterface.addIndex('t_device', ['service_id']);
await queryInterface.addIndex('t_device', ['room_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_device'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_device'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211035238-create-device-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ module.exports = {
await queryInterface.addIndex('t_device_feature', ['device_id']);
await queryInterface.addIndex('t_device_feature', ['category']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_device_feature'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_device_feature'),
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ module.exports = {

await queryInterface.addIndex('t_device_feature_state', ['device_feature_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_device_feature_state'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_device_feature_state'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211042223-create-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ module.exports = {
await queryInterface.addIndex('t_calendar', ['user_id']);
await queryInterface.addIndex('t_calendar', ['service_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_calendar'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_calendar'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211042644-create-calendar-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ module.exports = {
await queryInterface.addIndex('t_calendar_event', ['start']);
await queryInterface.addIndex('t_calendar_event', ['end']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_calendar_event'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_calendar_event'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211043231-create-pod.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ module.exports = {

await queryInterface.addIndex('t_pod', ['room_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_pod'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_pod'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211043515-create-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ module.exports = {
unique: true,
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_service'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_service'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211043957-create-variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ module.exports = {
unique: true,
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_variable'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_variable'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211044205-create-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_script'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_script'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211044442-create-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_area'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_area'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211044839-create-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_dashboard'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_dashboard'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211045110-create-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_scene'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_scene'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211045641-create-trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ module.exports = {
},
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_trigger'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_trigger'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211050844-trigger_scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ module.exports = {
await queryInterface.addIndex('t_trigger_scene', ['trigger_id']);
await queryInterface.addIndex('t_trigger_scene', ['scene_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_trigger_scene'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_trigger_scene'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190211051215-create-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ module.exports = {
await queryInterface.addIndex('t_message', ['sender_id']);
await queryInterface.addIndex('t_message', ['receiver_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_message'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_message'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190212043623-create-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ module.exports = {

await queryInterface.addIndex('t_session', ['user_id']);
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_session'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_session'),
};
2 changes: 1 addition & 1 deletion server/migrations/20190318084429-create-device-param.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ module.exports = {
unique: true,
});
},
down: (queryInterface, Sequelize) => queryInterface.dropTable('t_device_param'),
down: async (queryInterface, Sequelize) => queryInterface.dropTable('t_device_param'),
};
2 changes: 1 addition & 1 deletion server/migrations/20200123094438-add-triggers-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = {
// delete useless trigger_scene table
await queryInterface.dropTable('t_trigger_scene');
},
down: (queryInterface, Sequelize) => {},
down: async (queryInterface, Sequelize) => {},
};
4 changes: 2 additions & 2 deletions server/migrations/20200201125436-add-caldav-data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
up: (queryInterface, Sequelize) => {
up: async (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.addColumn('t_calendar', 'ctag', {
type: Sequelize.STRING,
Expand All @@ -10,5 +10,5 @@ module.exports = {
]);
},

down: (queryInterface, Sequelize) => {},
down: async (queryInterface, Sequelize) => {},
};
4 changes: 2 additions & 2 deletions server/migrations/20200207214849-add-calendar-event-url.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = {
up: (queryInterface, Sequelize) => {
up: async (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.addColumn('t_calendar_event', 'url', {
type: Sequelize.STRING,
}),
]);
},

down: (queryInterface, Sequelize) => {},
down: async (queryInterface, Sequelize) => {},
};
2 changes: 1 addition & 1 deletion server/migrations/20201128203008-add-color-caldav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = {
]);
},

down: (queryInterface, Sequelize) => {},
down: async (queryInterface, Sequelize) => {},
};
2 changes: 1 addition & 1 deletion server/migrations/20210129155044-multi-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ module.exports = {
}
},

down: (queryInterface, Sequelize) => {},
down: async (queryInterface, Sequelize) => {},
};
Loading

0 comments on commit 8afb962

Please sign in to comment.