aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0740-fix-old-enums.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-09-13 15:22:02 +0200
committerChocobozzz <me@florianbigard.com>2022-09-13 15:22:02 +0200
commitdb312c7023bb8263741255f8af1c8a6aef5f88f7 (patch)
treea27162fec676d0103922b659e69614cb4e4839a2 /server/initializers/migrations/0740-fix-old-enums.ts
parent7c9a251912cf4765e913bdf30cb204635609a3ab (diff)
downloadPeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.tar.gz
PeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.tar.zst
PeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.zip
Fix old DB enum names
Diffstat (limited to 'server/initializers/migrations/0740-fix-old-enums.ts')
-rw-r--r--server/initializers/migrations/0740-fix-old-enums.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/initializers/migrations/0740-fix-old-enums.ts b/server/initializers/migrations/0740-fix-old-enums.ts
new file mode 100644
index 000000000..501d0ccb2
--- /dev/null
+++ b/server/initializers/migrations/0740-fix-old-enums.ts
@@ -0,0 +1,33 @@
1import * as Sequelize from 'sequelize'
2
3async 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
24async function down (utils: {
25 queryInterface: Sequelize.QueryInterface
26 transaction: Sequelize.Transaction
27}) {
28}
29
30export {
31 up,
32 down
33}