diff options
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0130-video-channel-actor.ts | 13 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { DataType } from 'sequelize-typescript' | 2 | import { DataType } from 'sequelize-typescript' |
3 | import { createPrivateAndPublicKeys } from '../../helpers' | ||
3 | 4 | ||
4 | async function up (utils: { | 5 | async 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 | ||
228 | function down (options) { | 241 | function down (options) { |