Page MenuHomePhabricator

[keyserver] Increase `social_proof` column of `cookies` table from `varchar(255)` to `varchar(4096)`
ClosedPublic

Authored by atul on Dec 31 2022, 4:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 1:58 PM
Unknown Object (File)
Sun, Nov 10, 10:19 AM
Unknown Object (File)
Mon, Nov 4, 6:39 AM
Unknown Object (File)
Mon, Nov 4, 1:21 AM
Unknown Object (File)
Tue, Oct 22, 5:15 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Subscribers
None

Details

Summary

Was experiencing issues populating the social_proof column of the cookies table because the string I was attempting to store exceeded the "width" of the column:

f1f582.png (1×3 px, 742 KB)

This diff just increases the size to ensure that the message fits.


Depends on D6134

Test Plan
  1. Ensure migration ran successfully:

74e6c9.png (128×734 px, 23 KB)

5ef42e.png (238×480 px, 36 KB)

  1. Didn't test create-db, but confident things will work as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Dec 31 2022, 4:58 AM
atul edited the summary of this revision. (Show Details)
atul edited the test plan for this revision. (Show Details)
atul retitled this revision from [keyserver] Increase `social_proof` column of `cookies` table from `varchar(255)` to `varchar(1024)` to [keyserver] Increase `social_proof` column of `cookies` table from `varchar(255)` to `varchar(4096)`.Dec 31 2022, 4:10 PM

Accepting to unblock but I think this is too large for a VARCHAR column and you should use TEXT. Please either address before landing, or link a Linear task to address it before landing

keyserver/src/database/migration-config.js
146 ↗(On Diff #20490)

Is VARCHAR(4096) the right thing to use? Why not TEXT?

This revision is now accepted and ready to land.Jan 1 2023, 8:02 PM

Accepting to unblock but I think this is too large for a VARCHAR column and you should use TEXT. Please either address before landing, or link a Linear task to address it before landing

255 is the limit for VARCHAR to be one-byte length header + DATA. 65,532 is the limit for VARCHAR to be two-byte length header + DATA.

That said, there's no issue using TEXT instead. I'll update this diff.

I just saw that DEFAULT CHARSET=latin1;, wasn't sure what exactly that meant or the implications were, and went with VARCHAR because it seemed simpler?