Page MenuHomePhabricator

Give the session table a normal `id` column as a primary key
ClosedPublic

Authored by epriestley on Jan 15 2014, 8:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 7 2024, 11:54 PM
Unknown Object (File)
Feb 5 2024, 5:45 AM
Unknown Object (File)
Feb 5 2024, 5:44 AM
Unknown Object (File)
Feb 5 2024, 5:44 AM
Unknown Object (File)
Jan 29 2024, 8:32 PM
Unknown Object (File)
Jan 28 2024, 5:04 AM
Unknown Object (File)
Nov 25 2023, 3:19 AM
Unknown Object (File)
Nov 9 2023, 1:40 AM
Subscribers

Details

Summary

Ref T4310. Ref T3720. Two major things are going on here:

  • I'm making this table work more like a standard table, which, e.g., makes delete() simpler to implement.
  • Currently, the primary key is (userPHID, type). I want to get rid of this, issue unlimited sessions, and GC old sessions. This means we can't have a unique key on (userPHID, type) anymore. This removes it as the primary key and adds it as a normal key instead. There's no functional change -- the code to generate sessions guarantees that it will never write duplicate rows or write additional rows -- but allows us to drop the -1, -2 qualifiers in the future.
  • Also of note, our task is made far simpler here because MySQL will automatically assign values to new AUTO_INCREMENT columns, so we don't have to migrate to get real IDs.
Test Plan

Ran migrations, verified table looked sane. Logged out, logged in.

Diff Detail

Branch
sauth1
Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

cool beans

resources/sql/autopatches/20140115.auth.1.id.sql
5

what's the FIRST word do? just make it first in the list of columns?

resources/sql/autopatches/20140115.auth.1.id.sql
5

Yeah, the options are:

... AFTER <column>
... FIRST

This just makes it show up at the top of the table.