mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Give the session table a normal id
column as a primary key
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. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3720, T4310 Differential Revision: https://secure.phabricator.com/D7975
This commit is contained in:
parent
89bd84986a
commit
a64228b03f
2 changed files with 8 additions and 12 deletions
8
resources/sql/autopatches/20140115.auth.1.id.sql
Normal file
8
resources/sql/autopatches/20140115.auth.1.id.sql
Normal file
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE {$NAMESPACE}_user.phabricator_session
|
||||
DROP PRIMARY KEY;
|
||||
|
||||
ALTER TABLE {$NAMESPACE}_user.phabricator_session
|
||||
ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
|
||||
|
||||
ALTER TABLE {$NAMESPACE}_user.phabricator_session
|
||||
ADD KEY `key_identity` (userPHID, type);
|
|
@ -15,7 +15,6 @@ final class PhabricatorAuthSession extends PhabricatorAuthDAO
|
|||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_IDS => self::IDS_MANUAL,
|
||||
self::CONFIG_TIMESTAMPS => false,
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
@ -39,17 +38,6 @@ final class PhabricatorAuthSession extends PhabricatorAuthDAO
|
|||
return $this->assertAttached($this->identityObject);
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
// TODO: We don't have a proper `id` column yet, so make this work as
|
||||
// expected until we do.
|
||||
queryfx(
|
||||
$this->establishConnection('w'),
|
||||
'DELETE FROM %T WHERE sessionKey = %s',
|
||||
$this->getTableName(),
|
||||
$this->getSessionKey());
|
||||
return $this;
|
||||
}
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue