aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/migrations/0130-video-channel-actor.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/initializers/migrations/0130-video-channel-actor.ts b/server/initializers/migrations/0130-video-channel-actor.ts
index 0b665b0c7..15b67be81 100644
--- a/server/initializers/migrations/0130-video-channel-actor.ts
+++ b/server/initializers/migrations/0130-video-channel-actor.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { DataType } from 'sequelize-typescript' 2import { DataType } from 'sequelize-typescript'
3import { createPrivateAndPublicKeys } from '../../helpers'
3 4
4async function up (utils: { 5async function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -223,6 +224,18 @@ async function up (utils: {
223 await utils.queryInterface.removeColumn('videoChannel', columnToDelete) 224 await utils.queryInterface.removeColumn('videoChannel', columnToDelete)
224 } 225 }
225 } 226 }
227
228 {
229 const query = 'SELECT * FROM "actor" WHERE "serverId" IS NULL AND "publicKey" IS NULL'
230 const [ res ] = await utils.sequelize.query(query)
231
232 for (const actor of res) {
233 const { privateKey, publicKey } = await createPrivateAndPublicKeys()
234
235 const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${privateKey}' WHERE id = ${actor.id}`
236 await utils.sequelize.query(queryUpdate)
237 }
238 }
226} 239}
227 240
228function down (options) { 241function down (options) {