HomePhabricator
Diffusion Comm 762261bd4c4f

[server] Migrate database after permission updates

Description

[server] Migrate database after permission updates

Summary:
The diff migrates database to recalculate perimissions after changing default permissions for OPEN_SUBTHREADs.
I put updateRolesAndPermissionsForAllThreads function in thread-permission-updaters, but the function itself is taken from add-edit-thread-detailed-permissions.js migration script introduced in D1979.
As the script did exactly the same thing - recalculated permissions after introducing changes in default permission configuration - and we no longer use seaprate scripts for migrations, I think, it's better to put this function in updaters so it could be reused in the future if there is a need.

Test Plan: Migration is performed automatically when server starts. After the migration the issue: https://linear.app/comm/issue/ENG-1004/error-when-adding-user-that-is-not-in-parent-thread-to-open-subchannel no longer appears in any thread.

Reviewers: palys-swm, ashoat

Reviewed By: ashoat

Subscribers: Adrian, atul, yayabosh

Differential Revision: https://phab.comm.dev/D4071

Details

Provenance
jacekAuthored on Jul 15 2022, 1:54 AM
Reviewer
ashoat
Differential Revision
D4071: [server] Migrate database after permission updates
Parents
rCOMMdd58826093a1: [server] Use single connection with DB for migrations
Branches
Unknown
Tags
Unknown