RocketChat/Rocket.Chat

View on GitHub
apps/meteor/server/startup/migrations/v270.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { VoipRoom } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
    version: 270,
    async up() {
        // mark all voip rooms as inbound which doesn't have any direction property set or has an invalid value
        await VoipRoom.updateMany(
            {
                t: 'v',
                $or: [{ direction: { $exists: false } }, { direction: { $nin: ['inbound', 'outbound'] } }],
            },
            {
                $set: {
                    direction: 'inbound',
                },
            },
        );
    },
});