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
F1916698: D9981.diff
Fri, May 31, 11:08 AM
Unknown Object (File)
Wed, May 22, 5:09 AM
Unknown Object (File)
Wed, May 22, 5:09 AM
Unknown Object (File)
Wed, May 22, 5:07 AM
Unknown Object (File)
Wed, May 22, 4:31 AM
Unknown Object (File)
Tue, May 14, 6:22 PM
Unknown Object (File)
Apr 8 2024, 10:35 PM
Unknown Object (File)
Apr 8 2024, 10: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
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