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
F3185383: D9981.diff
Fri, Nov 8, 12:52 PM
Unknown Object (File)
Sat, Oct 26, 1:21 PM
Unknown Object (File)
Fri, Oct 11, 9:22 AM
Unknown Object (File)
Oct 2 2024, 4:13 AM
Unknown Object (File)
Oct 2 2024, 4:13 AM
Unknown Object (File)
Oct 2 2024, 4:13 AM
Unknown Object (File)
Oct 2 2024, 4:09 AM
Unknown Object (File)
Sep 22 2024, 5:35 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
No Lint Coverage
Unit
No Test Coverage

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