import * as Sequelize from 'sequelize'
import { DataType } from 'sequelize-typescript'
+import { createPrivateAndPublicKeys } from '../../helpers'
async function up (utils: {
transaction: Sequelize.Transaction,
await utils.queryInterface.removeColumn('videoChannel', columnToDelete)
}
}
+
+ {
+ const query = 'SELECT * FROM "actor" WHERE "serverId" IS NULL AND "publicKey" IS NULL'
+ const [ res ] = await utils.sequelize.query(query)
+
+ for (const actor of res) {
+ const { privateKey, publicKey } = await createPrivateAndPublicKeys()
+
+ const queryUpdate = `UPDATE "actor" SET "publicKey" = '${publicKey}', "privateKey" = '${privateKey}' WHERE id = ${actor.id}`
+ await utils.sequelize.query(queryUpdate)
+ }
+ }
}
function down (options) {