-
Notifications
You must be signed in to change notification settings - Fork 308
use id as primary key instead of username #835
Comments
I'd be surprised if there weren't an exploitable race condition hidden in there somewhere. |
What if we keep the username as the foreign key in the db but add joins and constraints on id when modifying data? We can either do joins when inspecting the db interactively (pita) or in the application when modifying the data (complicates the application somewhat). |
Why do we want it? |
I don't have a big problem right now with using username as the foreign key through the database. I could imagine reasons related to sharding at scale but we're not there yet. I'm closing this ticket. If someone cares about this we can reopen. |
We currently have 7 tables referencing |
There are certainly race conditions, because our web app process(es) is (are) multi-threaded. A |
Example: if one thread is changing a slug, and another thread is updating a payment instruction based on the slug, then the payment instruction will fail with an error because it won't find a Team with that slug, or—what's worse—it will silently fail by assigning the payment instruction to a Team that has managed to "steal" the old slug of the Team that is changing slugs. |
Upgrading to TeamX ★. |
@sammyshj Looking at #835 (comment), maybe |
Closing in light of our decision to shut down Gratipay. Thank you all for a great run, and I'm sorry it didn't work out! 😞 💃 |
We're adopting a zero-downtime approach (#3864 (comment)) here. Here are the basic steps for migrating from a column
foo
tofoo_id
without having to turn on maintenance mode:branch.sql
foo_id
columnfoo
andfoo_id
branch.sql
foo_id
based onfoo
foo_id
branch.sql
foo
foo
foo
foo
foo
andfoo_id
foo
foo
andfoo_id
foo_id
foo_id
foo_id
Todo
See #503 and #287.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: