]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/migrations/0740-fix-old-enums.ts
Fix old DB enum names
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0740-fix-old-enums.ts
1 import * as Sequelize from 'sequelize'
2
3 async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8 }): Promise<void> {
9 try {
10 await utils.sequelize.query('drop type "enum_actorFollow_state"')
11 await utils.sequelize.query('alter type "enum_AccountFollows_state" rename to "enum_actorFollow_state";')
12 } catch {
13 // empty
14 }
15
16 try {
17 await utils.sequelize.query('drop type "enum_accountVideoRate_type"')
18 await utils.sequelize.query('alter type "enum_AccountVideoRates_type" rename to "enum_accountVideoRate_type";')
19 } catch {
20 // empty
21 }
22 }
23
24 async function down (utils: {
25 queryInterface: Sequelize.QueryInterface
26 transaction: Sequelize.Transaction
27 }) {
28 }
29
30 export {
31 up,
32 down
33 }