1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Generate expected Project schemata

Summary:
Ref T1191. Notes:

  - Drops the project affiliation table. This is a very old membership table which was migrated to edges.
  - Drops the subproject table. This is a very old table for a removed feature.

Test Plan:
  - Grepped for dropped tables.
  - Saw ~100 fewer setup issues.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10581
This commit is contained in:
epriestley 2014-10-01 07:37:01 -07:00
parent 098d0d93d6
commit ac9182af58
10 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1 @@
DROP TABLE {$NAMESPACE}_project.project_affiliation;

View file

@ -0,0 +1 @@
DROP TABLE {$NAMESPACE}_project.project_subproject;

View file

@ -2052,6 +2052,7 @@ phutil_register_library_map(array(
'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php',
'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php',
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
'PhabricatorProjectSchemaSpec' => 'applications/project/storage/PhabricatorProjectSchemaSpec.php',
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php',
'PhabricatorProjectSlug' => 'applications/project/storage/PhabricatorProjectSlug.php',
@ -5018,6 +5019,7 @@ phutil_register_library_map(array(
'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType',
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProjectSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorProjectSlug' => 'PhabricatorProjectDAO',

View file

@ -170,6 +170,7 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
array(
'PRIMARY' => array(
'columns' => array('counterName'),
'unique' => true,
),
));
}

View file

@ -9,6 +9,19 @@ final class ManiphestTaskSubscriber extends ManiphestDAO {
return array(
self::CONFIG_IDS => self::IDS_MANUAL,
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'id' => null,
),
self::CONFIG_KEY_SCHEMA => array(
'PRIMARY' => array(
'columns' => array('subscriberPHID', 'taskPHID'),
'unique' => true,
),
'taskPHID' => array(
'columns' => array('taskPHID', 'subscriberPHID'),
'unique' => true,
),
),
);
}

View file

@ -121,6 +121,37 @@ final class PhabricatorProject extends PhabricatorProjectDAO
self::CONFIG_SERIALIZATION => array(
'subprojectPHIDs' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'status' => 'text32',
'phrictionSlug' => 'text128?',
'joinPolicy' => 'policy',
'isMembershipLocked' => 'bool',
'profileImagePHID' => 'phid?',
'icon' => 'text32',
'color' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'key_icon' => array(
'columns' => array('icon'),
),
'key_color' => array(
'columns' => array('color'),
),
'phrictionSlug' => array(
'columns' => array('phrictionSlug'),
'unique' => true,
),
'name' => array(
'columns' => array('name'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

@ -33,6 +33,19 @@ final class PhabricatorProjectColumn
self::CONFIG_SERIALIZATION => array(
'properties' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'status' => 'uint32',
'sequence' => 'uint32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_status' => array(
'columns' => array('projectPHID', 'status', 'sequence'),
),
'key_sequence' => array(
'columns' => array('projectPHID', 'sequence'),
),
),
) + parent::getConfiguration();
}

View file

@ -13,6 +13,21 @@ final class PhabricatorProjectColumnPosition extends PhabricatorProjectDAO
public function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'sequence' => 'uint32',
),
self::CONFIG_KEY_SCHEMA => array(
'boardPHID' => array(
'columns' => array('boardPHID', 'columnPHID', 'objectPHID'),
'unique' => true,
),
'objectPHID' => array(
'columns' => array('objectPHID', 'boardPHID'),
),
'boardPHID_2' => array(
'columns' => array('boardPHID', 'columnPHID', 'sequence'),
),
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,48 @@
<?php
final class PhabricatorProjectSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorProjectDAO');
$this->buildEdgeSchemata(new PhabricatorProject());
$this->buildTransactionSchema(
new PhabricatorProjectTransaction());
$this->buildCustomFieldSchemata(
new PhabricatorProjectCustomFieldStorage(),
array(
new PhabricatorProjectCustomFieldNumericIndex(),
new PhabricatorProjectCustomFieldStringIndex(),
));
$this->buildTransactionSchema(
new PhabricatorProjectColumnTransaction());
$this->buildRawSchema(
id(new PhabricatorProject())->getApplicationName(),
PhabricatorProject::TABLE_DATASOURCE_TOKEN,
array(
'id' => 'id',
'projectID' => 'id',
'token' => 'text128',
),
array(
'PRIMARY' => array(
'columns' => array('id'),
'unique' => true,
),
'token' => array(
'columns' => array('token', 'projectID'),
'unique' => true,
),
'projectID' => array(
'columns' => array('projectID'),
),
));
}
}

View file

@ -5,4 +5,21 @@ final class PhabricatorProjectSlug extends PhabricatorProjectDAO {
protected $slug;
protected $projectPHID;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'slug' => 'text128',
),
self::CONFIG_KEY_SCHEMA => array(
'key_slug' => array(
'columns' => array('slug'),
'unique' => true,
),
'key_projectPHID' => array(
'columns' => array('projectPHID'),
),
),
) + parent::getConfiguration();
}
}