aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-19 10:52:40 +0200
committerChocobozzz <me@florianbigard.com>2023-06-19 10:52:40 +0200
commit7aacaa76ec990f6b06f3f15a5666d103f68594f1 (patch)
tree89f441d1e1730e1ffeebeee4f59be8a20f202711 /server/initializers
parent7c77ace9a7678e2e0e15644b0080f2dd31d2f7ec (diff)
downloadPeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.tar.gz
PeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.tar.zst
PeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.zip
Fix registration notification error in client
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0780-notification-registration.ts30
2 files changed, 31 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 020ed68da..a92fd22d6 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -27,7 +27,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
27 27
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29 29
30const LAST_MIGRATION_VERSION = 775 30const LAST_MIGRATION_VERSION = 780
31 31
32// --------------------------------------------------------------------------- 32// ---------------------------------------------------------------------------
33 33
diff --git a/server/initializers/migrations/0780-notification-registration.ts b/server/initializers/migrations/0780-notification-registration.ts
new file mode 100644
index 000000000..5f1e0d2ea
--- /dev/null
+++ b/server/initializers/migrations/0780-notification-registration.ts
@@ -0,0 +1,30 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<void> {
8 const { transaction } = utils
9
10 {
11 await utils.sequelize.query('DELETE FROM "userNotification" WHERE type = 20 AND "userRegistrationId" IS NULL', { transaction })
12 }
13
14 {
15 await utils.sequelize.query(
16 'ALTER TABLE "userNotification" DROP CONSTRAINT "userNotification_userRegistrationId_fkey", ' +
17 'ADD CONSTRAINT "userNotification_userRegistrationId_fkey" ' +
18 'FOREIGN KEY ("userRegistrationId") REFERENCES "userRegistration" ("id") ON DELETE CASCADE ON UPDATE CASCADE',
19 { transaction })
20 }
21}
22
23function down (options) {
24 throw new Error('Not implemented.')
25}
26
27export {
28 up,
29 down
30}