Page MenuHomePhabricator

[sql] added ethereum_address to users table
ClosedPublic

Authored by derek on Nov 8 2022, 12:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 5:08 AM
Unknown Object (File)
Sun, Nov 24, 6:31 AM
Unknown Object (File)
Fri, Nov 22, 9:03 PM
Unknown Object (File)
Tue, Nov 19, 9:00 PM
Unknown Object (File)
Tue, Nov 19, 9:00 PM
Unknown Object (File)
Tue, Nov 19, 4:12 PM
Unknown Object (File)
Tue, Nov 19, 4:12 PM
Unknown Object (File)
Tue, Nov 19, 4:12 PM

Details

Summary

self explanatory
linear task

Test Plan

run keyserver & watch it migrate.
also run

mysql -u root -p
...
DROP DATABASE comm;
CREATE DATABASE comm;

image.png (160×538 px, 81 KB)

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

I want to make sure @tomek takes a look since he has the most context on our MySQL setup

Overall looks good to me. Assume you've carefully tested that 42 chars is the right number?

Overall looks good to me. Assume you've carefully tested that 42 chars is the right number?

yeah, it'd be 40 but i figured we'd include 0x

Ah, I think we can skip 0x and save some space in the DB

Ah, I think we can skip 0x and save some space in the DB

I think that saving 2 bytes doesn't make any difference. What could make a difference is remembering in every place that we have to add 0x when reading from the db and removing it when writing. So for me we should keep it to make it more maintainable.

run keyserver & watch it migrate

It's also a good idea to check if creating an empty db also works correctly.

keyserver/src/database/migration-config.js
72

Shouldn't matter too much, but it's a good practice to make code idempotent if possible: so in this case ADD COLUMN IF NOT EXISTS would be slightly better.

This revision is now accepted and ready to land.Nov 9 2022, 5:53 AM

I see 0x as a purely visual treatment, so I would prefer to have that handled by the UI.

It's also a good idea to check if creating an empty db also works correctly.

@derek can you amend your Test Plan to cover that please?

keyserver/src/database/migration-config.js
72

Good call. This is something we probably should've learned from D5521

I see 0x as a purely visual treatment, so I would prefer to have that handled by the UI.

It's also a good idea to check if creating an empty db also works correctly.

@derek can you amend your Test Plan to cover that please?

all the frontend clients (wagmi, rainbowkit, even alchemy) give us the address with the 0x prefixed. i agree with tomek, it feels like a lot of roundtripping to add & remove it just for db writes to save a couple bytes

updated migration to be idempotent

derek marked 2 inline comments as done.

Okay, the length of the field doesn't really matter. I won't block you on this, but it seems kinda wasteful to me

Please make sure you've tested all of this before landing

This revision is now accepted and ready to land.Nov 9 2022, 8:16 AM