"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.down = exports.up = void 0;
const tslib_1 = require("tslib");
const Sequelize = tslib_1.__importStar(require("sequelize"));
function up(utils) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        const query = 'DELETE FROM "accountVideoRate" ' +
            'WHERE "accountVideoRate".id IN (' +
            'SELECT "accountVideoRate".id FROM "accountVideoRate" ' +
            'INNER JOIN account ON account.id = "accountVideoRate"."accountId" ' +
            'INNER JOIN actor ON actor.id = account."actorId" ' +
            'INNER JOIN video ON video.id = "accountVideoRate"."videoId" ' +
            'WHERE actor."serverId" IS NOT NULL AND video.remote IS TRUE' +
            ')';
        yield utils.sequelize.query(query, { type: Sequelize.QueryTypes.BULKDELETE, transaction: utils.transaction });
    });
}
exports.up = up;
function down() {
    throw new Error('Not implemented.');
}
exports.down = down;
//# sourceMappingURL=0695-remove-remote-rates.js.map