aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
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/migrations
parent7c77ace9a7678e2e0e15644b0080f2dd31d2f7ec (diff)
downloadPeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.tar.gz
PeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.tar.zst
PeerTube-7aacaa76ec990f6b06f3f15a5666d103f68594f1.zip
Fix registration notification error in client
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0780-notification-registration.ts30
1 files changed, 30 insertions, 0 deletions
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}