mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Generate expected schemata for User/People tables
Summary: Ref T1191. Some notes here: - Drops the old LDAP and OAuth info tables. These were migrated to the ExternalAccount table a very long time ago. - Separates surplus/missing keys from other types of surplus/missing things. In the long run, my plan is to have only two notice levels: - Error: something we can't fix (missing database, table, or column; overlong key). - Warning: something we can fix (surplus anything, missing key, bad column type, bad key columns, bad uniqueness, bad collation or charset). - For now, retaining three levels is helpful in generating all the expected scheamta. Test Plan: - Saw ~200 issues resolve, leaving ~1,300. - Grepped for removed tables. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10580
This commit is contained in:
parent
3fe226f9f0
commit
098d0d93d6
17 changed files with 284 additions and 6 deletions
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE {$NAMESPACE}_user.user_ldapinfo;
|
|
@ -0,0 +1 @@
|
||||||
|
DROP TABLE {$NAMESPACE}_user.user_oauthinfo;
|
|
@ -2419,6 +2419,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
|
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
|
||||||
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
|
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
|
||||||
'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php',
|
'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php',
|
||||||
|
'PhabricatorUserSchemaSpec' => 'applications/people/storage/PhabricatorUserSchemaSpec.php',
|
||||||
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
|
'PhabricatorUserSearchIndexer' => 'applications/people/search/PhabricatorUserSearchIndexer.php',
|
||||||
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
|
'PhabricatorUserSinceField' => 'applications/people/customfield/PhabricatorUserSinceField.php',
|
||||||
'PhabricatorUserStatusField' => 'applications/people/customfield/PhabricatorUserStatusField.php',
|
'PhabricatorUserStatusField' => 'applications/people/customfield/PhabricatorUserStatusField.php',
|
||||||
|
@ -5417,6 +5418,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
|
||||||
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
|
||||||
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',
|
'PhabricatorUserSSHKey' => 'PhabricatorUserDAO',
|
||||||
|
'PhabricatorUserSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||||
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
'PhabricatorUserSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||||
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserSinceField' => 'PhabricatorUserCustomField',
|
||||||
'PhabricatorUserStatusField' => 'PhabricatorUserCustomField',
|
'PhabricatorUserStatusField' => 'PhabricatorUserCustomField',
|
||||||
|
|
|
@ -19,6 +19,26 @@ final class PhabricatorAuthSession extends PhabricatorAuthDAO
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'type' => 'text32',
|
||||||
|
'sessionKey' => 'bytes40',
|
||||||
|
'sessionStart' => 'epoch',
|
||||||
|
'sessionExpires' => 'epoch',
|
||||||
|
'highSecurityUntil' => 'epoch?',
|
||||||
|
'isPartial' => 'bool',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'sessionKey' => array(
|
||||||
|
'columns' => array('sessionKey'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'key_identity' => array(
|
||||||
|
'columns' => array('userPHID', 'type'),
|
||||||
|
),
|
||||||
|
'key_expires' => array(
|
||||||
|
'columns' => array('sessionExpires'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,12 +269,23 @@ final class PhabricatorConfigSchemaQuery extends Phobject {
|
||||||
PhabricatorConfigStorageSchema $expect = null,
|
PhabricatorConfigStorageSchema $expect = null,
|
||||||
PhabricatorConfigStorageSchema $actual = null) {
|
PhabricatorConfigStorageSchema $actual = null) {
|
||||||
|
|
||||||
|
$expect_is_key = ($expect instanceof PhabricatorConfigKeySchema);
|
||||||
|
$actual_is_key = ($actual instanceof PhabricatorConfigKeySchema);
|
||||||
|
|
||||||
|
if ($expect_is_key || $actual_is_key) {
|
||||||
|
$missing_issue = PhabricatorConfigStorageSchema::ISSUE_MISSINGKEY;
|
||||||
|
$surplus_issue = PhabricatorConfigStorageSchema::ISSUE_SURPLUSKEY;
|
||||||
|
} else {
|
||||||
|
$missing_issue = PhabricatorConfigStorageSchema::ISSUE_MISSING;
|
||||||
|
$surplus_issue = PhabricatorConfigStorageSchema::ISSUE_SURPLUS;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$expect && !$actual) {
|
if (!$expect && !$actual) {
|
||||||
throw new Exception(pht('Can not compare two missing schemata!'));
|
throw new Exception(pht('Can not compare two missing schemata!'));
|
||||||
} else if ($expect && !$actual) {
|
} else if ($expect && !$actual) {
|
||||||
$issues = array(PhabricatorConfigStorageSchema::ISSUE_MISSING);
|
$issues = array($missing_issue);
|
||||||
} else if ($actual && !$expect) {
|
} else if ($actual && !$expect) {
|
||||||
$issues = array(PhabricatorConfigStorageSchema::ISSUE_SURPLUS);
|
$issues = array($surplus_issue);
|
||||||
} else {
|
} else {
|
||||||
$issues = $actual->compareTo($expect);
|
$issues = $actual->compareTo($expect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
||||||
$charset = 'binary';
|
$charset = 'binary';
|
||||||
$collation = 'binary';
|
$collation = 'binary';
|
||||||
break;
|
break;
|
||||||
|
case 'bytes64':
|
||||||
|
$column_type = 'char(64)';
|
||||||
|
$charset = 'binary';
|
||||||
|
$collation = 'binary';
|
||||||
|
break;
|
||||||
case 'bytes40':
|
case 'bytes40':
|
||||||
$column_type = 'char(40)';
|
$column_type = 'char(40)';
|
||||||
$charset = 'binary';
|
$charset = 'binary';
|
||||||
|
@ -278,6 +283,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
||||||
$charset = $this->getUTF8Charset();
|
$charset = $this->getUTF8Charset();
|
||||||
$collation = $this->getUTF8Collation();
|
$collation = $this->getUTF8Collation();
|
||||||
break;
|
break;
|
||||||
|
case 'text160':
|
||||||
|
$column_type = 'varchar(160)';
|
||||||
|
$charset = $this->getUTF8Charset();
|
||||||
|
$collation = $this->getUTF8Collation();
|
||||||
|
break;
|
||||||
case 'text128':
|
case 'text128':
|
||||||
$column_type = 'varchar(128)';
|
$column_type = 'varchar(128)';
|
||||||
$charset = $this->getUTF8Charset();
|
$charset = $this->getUTF8Charset();
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
abstract class PhabricatorConfigStorageSchema extends Phobject {
|
abstract class PhabricatorConfigStorageSchema extends Phobject {
|
||||||
|
|
||||||
const ISSUE_MISSING = 'missing';
|
const ISSUE_MISSING = 'missing';
|
||||||
|
const ISSUE_MISSINGKEY = 'missingkey';
|
||||||
const ISSUE_SURPLUS = 'surplus';
|
const ISSUE_SURPLUS = 'surplus';
|
||||||
|
const ISSUE_SURPLUSKEY = 'surpluskey';
|
||||||
const ISSUE_CHARSET = 'charset';
|
const ISSUE_CHARSET = 'charset';
|
||||||
const ISSUE_COLLATION = 'collation';
|
const ISSUE_COLLATION = 'collation';
|
||||||
const ISSUE_COLUMNTYPE = 'columntype';
|
const ISSUE_COLUMNTYPE = 'columntype';
|
||||||
|
@ -102,8 +104,12 @@ abstract class PhabricatorConfigStorageSchema extends Phobject {
|
||||||
switch ($issue) {
|
switch ($issue) {
|
||||||
case self::ISSUE_MISSING:
|
case self::ISSUE_MISSING:
|
||||||
return pht('Missing');
|
return pht('Missing');
|
||||||
|
case self::ISSUE_MISSINGKEY:
|
||||||
|
return pht('Missing Key');
|
||||||
case self::ISSUE_SURPLUS:
|
case self::ISSUE_SURPLUS:
|
||||||
return pht('Surplus');
|
return pht('Surplus');
|
||||||
|
case self::ISSUE_SURPLUSKEY:
|
||||||
|
return pht('Surplus Key');
|
||||||
case self::ISSUE_CHARSET:
|
case self::ISSUE_CHARSET:
|
||||||
return pht('Better Character Set Available');
|
return pht('Better Character Set Available');
|
||||||
case self::ISSUE_COLLATION:
|
case self::ISSUE_COLLATION:
|
||||||
|
@ -131,8 +137,12 @@ abstract class PhabricatorConfigStorageSchema extends Phobject {
|
||||||
switch ($issue) {
|
switch ($issue) {
|
||||||
case self::ISSUE_MISSING:
|
case self::ISSUE_MISSING:
|
||||||
return pht('This schema is expected to exist, but does not.');
|
return pht('This schema is expected to exist, but does not.');
|
||||||
|
case self::ISSUE_MISSINGKEY:
|
||||||
|
return pht('This key is expected to exist, but does not.');
|
||||||
case self::ISSUE_SURPLUS:
|
case self::ISSUE_SURPLUS:
|
||||||
return pht('This schema is not expected to exist.');
|
return pht('This schema is not expected to exist.');
|
||||||
|
case self::ISSUE_SURPLUSKEY:
|
||||||
|
return pht('This key is not expected to exist.');
|
||||||
case self::ISSUE_CHARSET:
|
case self::ISSUE_CHARSET:
|
||||||
return pht('This schema can use a better character set.');
|
return pht('This schema can use a better character set.');
|
||||||
case self::ISSUE_COLLATION:
|
case self::ISSUE_COLLATION:
|
||||||
|
@ -159,14 +169,16 @@ abstract class PhabricatorConfigStorageSchema extends Phobject {
|
||||||
public static function getIssueStatus($issue) {
|
public static function getIssueStatus($issue) {
|
||||||
switch ($issue) {
|
switch ($issue) {
|
||||||
case self::ISSUE_MISSING:
|
case self::ISSUE_MISSING:
|
||||||
|
case self::ISSUE_MISSINGKEY:
|
||||||
case self::ISSUE_SUBFAIL:
|
case self::ISSUE_SUBFAIL:
|
||||||
return self::STATUS_FAIL;
|
return self::STATUS_FAIL;
|
||||||
case self::ISSUE_SURPLUS:
|
case self::ISSUE_SURPLUS:
|
||||||
case self::ISSUE_COLUMNTYPE:
|
case self::ISSUE_SURPLUSKEY:
|
||||||
case self::ISSUE_SUBWARN:
|
case self::ISSUE_SUBWARN:
|
||||||
|
case self::ISSUE_COLUMNTYPE:
|
||||||
case self::ISSUE_KEYCOLUMNS:
|
case self::ISSUE_KEYCOLUMNS:
|
||||||
case self::ISSUE_NULLABLE:
|
|
||||||
case self::ISSUE_UNIQUE:
|
case self::ISSUE_UNIQUE:
|
||||||
|
case self::ISSUE_NULLABLE:
|
||||||
return self::STATUS_WARN;
|
return self::STATUS_WARN;
|
||||||
case self::ISSUE_SUBNOTE:
|
case self::ISSUE_SUBNOTE:
|
||||||
case self::ISSUE_CHARSET:
|
case self::ISSUE_CHARSET:
|
||||||
|
|
|
@ -39,6 +39,31 @@ final class PhabricatorExternalAccount extends PhabricatorUserDAO
|
||||||
self::CONFIG_SERIALIZATION => array(
|
self::CONFIG_SERIALIZATION => array(
|
||||||
'properties' => self::SERIALIZATION_JSON,
|
'properties' => self::SERIALIZATION_JSON,
|
||||||
),
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'userPHID' => 'phid?',
|
||||||
|
'accountType' => 'text16',
|
||||||
|
'accountDomain' => 'text64',
|
||||||
|
'accountSecret' => 'text?',
|
||||||
|
'accountID' => 'text160',
|
||||||
|
'displayName' => 'text255?',
|
||||||
|
'username' => 'text255?',
|
||||||
|
'realName' => 'text255?',
|
||||||
|
'email' => 'text255?',
|
||||||
|
'emailVerified' => 'bool',
|
||||||
|
'profileImagePHID' => 'phid?',
|
||||||
|
'accountURI' => 'text255?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_phid' => null,
|
||||||
|
'phid' => array(
|
||||||
|
'columns' => array('phid'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'account_details' => array(
|
||||||
|
'columns' => array('accountType', 'accountDomain', 'accountID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,44 @@ final class PhabricatorUser
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'userName' => 'text64',
|
||||||
|
'realName' => 'text128',
|
||||||
|
'sex' => 'text4?',
|
||||||
|
'translation' => 'text64?',
|
||||||
|
'passwordSalt' => 'text32?',
|
||||||
|
'passwordHash' => 'text128?',
|
||||||
|
'profileImagePHID' => 'phid?',
|
||||||
|
'consoleEnabled' => 'bool',
|
||||||
|
'consoleVisible' => 'bool',
|
||||||
|
'consoleTab' => 'text64',
|
||||||
|
'conduitCertificate' => 'text255',
|
||||||
|
'isSystemAgent' => 'bool',
|
||||||
|
'isDisabled' => 'bool',
|
||||||
|
'isAdmin' => 'bool',
|
||||||
|
'timezoneIdentifier' => 'text255',
|
||||||
|
'isEmailVerified' => 'uint32',
|
||||||
|
'isApproved' => 'uint32',
|
||||||
|
'accountSecret' => 'bytes64',
|
||||||
|
'isEnrolledInMultiFactor' => 'bool',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_phid' => null,
|
||||||
|
'phid' => array(
|
||||||
|
'columns' => array('phid'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'userName' => array(
|
||||||
|
'columns' => array('userName'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'realName' => array(
|
||||||
|
'columns' => array('realName'),
|
||||||
|
),
|
||||||
|
'key_approved' => array(
|
||||||
|
'columns' => array('isApproved'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,26 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO {
|
||||||
|
|
||||||
const MAX_ADDRESS_LENGTH = 128;
|
const MAX_ADDRESS_LENGTH = 128;
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'address' => 'text128',
|
||||||
|
'isVerified' => 'bool',
|
||||||
|
'isPrimary' => 'bool',
|
||||||
|
'verificationCode' => 'text64?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'address' => array(
|
||||||
|
'columns' => array('address'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'userPHID' => array(
|
||||||
|
'columns' => array('userPHID', 'isPrimary'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
public function getVerificationURI() {
|
public function getVerificationURI() {
|
||||||
return '/emailverify/'.$this->getVerificationCode().'/';
|
return '/emailverify/'.$this->getVerificationCode().'/';
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,32 @@ final class PhabricatorUserLog extends PhabricatorUserDAO
|
||||||
'newValue' => self::SERIALIZATION_JSON,
|
'newValue' => self::SERIALIZATION_JSON,
|
||||||
'details' => self::SERIALIZATION_JSON,
|
'details' => self::SERIALIZATION_JSON,
|
||||||
),
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'actorPHID' => 'phid?',
|
||||||
|
'action' => 'text64',
|
||||||
|
'remoteAddr' => 'text64',
|
||||||
|
'session' => 'bytes40?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'actorPHID' => array(
|
||||||
|
'columns' => array('actorPHID', 'dateCreated'),
|
||||||
|
),
|
||||||
|
'userPHID' => array(
|
||||||
|
'columns' => array('userPHID', 'dateCreated'),
|
||||||
|
),
|
||||||
|
'action' => array(
|
||||||
|
'columns' => array('action', 'dateCreated'),
|
||||||
|
),
|
||||||
|
'dateCreated' => array(
|
||||||
|
'columns' => array('dateCreated'),
|
||||||
|
),
|
||||||
|
'remoteAddr' => array(
|
||||||
|
'columns' => array('remoteAddr', 'dateCreated'),
|
||||||
|
),
|
||||||
|
'session' => array(
|
||||||
|
'columns' => array('session', 'dateCreated'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,20 @@ final class PhabricatorUserProfile extends PhabricatorUserDAO {
|
||||||
protected $blurb;
|
protected $blurb;
|
||||||
protected $profileImagePHID;
|
protected $profileImagePHID;
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'title' => 'text255',
|
||||||
|
'blurb' => 'text',
|
||||||
|
'profileImagePHID' => 'phid?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'userPHID' => array(
|
||||||
|
'columns' => array('userPHID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorUserSchemaSpec extends PhabricatorConfigSchemaSpec {
|
||||||
|
|
||||||
|
public function buildSchemata() {
|
||||||
|
$this->buildLiskSchemata('PhabricatorUserDAO');
|
||||||
|
|
||||||
|
$this->buildEdgeSchemata(new PhabricatorUser());
|
||||||
|
|
||||||
|
$this->buildTransactionSchema(
|
||||||
|
new PhabricatorUserTransaction());
|
||||||
|
|
||||||
|
$this->buildCustomFieldSchemata(
|
||||||
|
new PhabricatorUserConfiguredCustomFieldStorage(),
|
||||||
|
array(
|
||||||
|
new PhabricatorUserCustomFieldNumericIndex(),
|
||||||
|
new PhabricatorUserCustomFieldStringIndex(),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->buildRawSchema(
|
||||||
|
id(new PhabricatorUser())->getApplicationName(),
|
||||||
|
PhabricatorUser::NAMETOKEN_TABLE,
|
||||||
|
array(
|
||||||
|
'token' => 'text255',
|
||||||
|
'userID' => 'id',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'token' => array(
|
||||||
|
'columns' => array('token'),
|
||||||
|
),
|
||||||
|
'userID' => array(
|
||||||
|
'columns' => array('userID'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -46,6 +46,12 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
|
||||||
'preferences' => self::SERIALIZATION_JSON,
|
'preferences' => self::SERIALIZATION_JSON,
|
||||||
),
|
),
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'userPHID' => array(
|
||||||
|
'columns' => array('userPHID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,27 @@ final class PhabricatorUserSSHKey extends PhabricatorUserDAO {
|
||||||
protected $keyHash;
|
protected $keyHash;
|
||||||
protected $keyComment;
|
protected $keyComment;
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'name' => 'text255',
|
||||||
|
'keyType' => 'text255',
|
||||||
|
'keyBody' => 'text',
|
||||||
|
'keyHash' => 'bytes32',
|
||||||
|
'keyComment' => 'text255?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'userPHID' => array(
|
||||||
|
'columns' => array('userPHID'),
|
||||||
|
),
|
||||||
|
'keyHash' => array(
|
||||||
|
'columns' => array('keyHash'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
public function getEntireKey() {
|
public function getEntireKey() {
|
||||||
$parts = array(
|
$parts = array(
|
||||||
$this->getKeyType(),
|
$this->getKeyType(),
|
||||||
|
|
|
@ -8,15 +8,35 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
|
||||||
private $localTime;
|
private $localTime;
|
||||||
|
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
$parent = parent::getConfiguration();
|
||||||
|
|
||||||
|
$config = array(
|
||||||
self::CONFIG_IDS => self::IDS_COUNTER,
|
self::CONFIG_IDS => self::IDS_COUNTER,
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
'dataID' => array(
|
'dataID' => array(
|
||||||
'columns' => array('dataID'),
|
'columns' => array('dataID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'taskClass' => array(
|
||||||
|
'columns' => array('taskClass'),
|
||||||
|
),
|
||||||
|
'leaseExpires' => array(
|
||||||
|
'columns' => array('leaseExpires'),
|
||||||
|
),
|
||||||
|
'leaseOwner' => array(
|
||||||
|
'columns' => array('leaseOwner(16)'),
|
||||||
|
),
|
||||||
|
'key_failuretime' => array(
|
||||||
|
'columns' => array('failureTime'),
|
||||||
|
),
|
||||||
|
'leaseOwner_2' => array(
|
||||||
|
'columns' => array('leaseOwner', 'priority', 'id'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
) + parent::getConfiguration();
|
);
|
||||||
|
|
||||||
|
return $config + $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setServerTime($server_time) {
|
public function setServerTime($server_time) {
|
||||||
|
|
|
@ -11,10 +11,21 @@ final class PhabricatorWorkerArchiveTask extends PhabricatorWorkerTask {
|
||||||
|
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
$config = parent::getConfiguration();
|
$config = parent::getConfiguration();
|
||||||
|
|
||||||
$config[self::CONFIG_COLUMN_SCHEMA] = array(
|
$config[self::CONFIG_COLUMN_SCHEMA] = array(
|
||||||
'result' => 'uint32',
|
'result' => 'uint32',
|
||||||
'duration' => 'uint64',
|
'duration' => 'uint64',
|
||||||
) + $config[self::CONFIG_COLUMN_SCHEMA];
|
) + $config[self::CONFIG_COLUMN_SCHEMA];
|
||||||
|
|
||||||
|
$config[self::CONFIG_KEY_SCHEMA] = array(
|
||||||
|
'dateCreated' => array(
|
||||||
|
'columns' => array('dateCreated'),
|
||||||
|
),
|
||||||
|
'leaseOwner' => array(
|
||||||
|
'columns' => array('leaseOwner', 'priority', 'id'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue