Page MenuHomePhabricator

[keyserver] Update usage of threads.default_role in thread-creator.js
ClosedPublic

Authored by rohan on Nov 24 2023, 9:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 28, 11:30 AM
Unknown Object (File)
Sat, Nov 9, 2:40 AM
Unknown Object (File)
Sat, Nov 9, 2:33 AM
Unknown Object (File)
Sat, Nov 9, 2:30 AM
Unknown Object (File)
Sat, Nov 9, 1:29 AM
Unknown Object (File)
Fri, Nov 8, 5:42 PM
Unknown Object (File)
Fri, Nov 8, 12:52 PM
Unknown Object (File)
Oct 26 2024, 1:21 PM
Subscribers

Details

Summary

We need to get rid of usages of threads.default_role throughout the codebase so we can eventually drop the column.

This diff handles the usage in thread-creator.js

Existing code: When creating a thread, the roles from createInitialRolesForNewThread are used to populate the role ID into threads.default_role for that specific row. We should no longer populate this field.

Depends on D9980

Addresses part of ENG-5833

Test Plan
  1. Ran ALTER TABLE threads MODIFY COLUMN default_role bigint(20) NULL; to allow NULL values in the column for now (until the column is dropped)
  2. Created a new thread and checked to make sure that no role got inserted into default_role

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Is the default_role column nullable at this point?

This revision is now accepted and ready to land.Nov 27 2023, 3:19 AM
In D9981#291960, @tomek wrote:

Is the default_role column nullable at this point?

This query would attempt to insert a NULL value into default_role, but without running ALTER TABLE threads MODIFY COLUMN default_role bigint(20) NULL, you'd see an error because it still expects a non-null value.

I felt like adding a migration to allow it to be nullable wouldn't be very useful since the very next diff drops the column entirely anyways