aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
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
parent7c9a251912cf4765e913bdf30cb204635609a3ab (diff)
downloadPeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.tar.gz
PeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.tar.zst
PeerTube-db312c7023bb8263741255f8af1c8a6aef5f88f7.zip
Fix old DB enum names
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0740-fix-old-enums.ts33
2 files changed, 34 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index f7d9a41da..7039ab457 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -25,7 +25,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
25 25
26// --------------------------------------------------------------------------- 26// ---------------------------------------------------------------------------
27 27
28const LAST_MIGRATION_VERSION = 735 28const LAST_MIGRATION_VERSION = 740
29 29
30// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
31 31
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}