1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-11 08:06:13 +01:00
phorge-phorge/src/applications/differential/storage/DifferentialSchemaSpec.php
epriestley c767c971ca Add "persistence" types (data, cache, or index) to tables, and tweak what "storage dump" dumps
Summary:
Ref T13000. This marks each table as either "data" (normal data), "cache" (automatically rebuilt, no need to ever dump) or "index" (can be manually rebuilt).

By default, `bin/storage dump` dumps data and index tables, but not cache tables.

With `--no-indexes`, it dumps only data tables. Indexes can be rebuilt after a restore with `bin/search index --all ...`.

Test Plan:
  - Ran `--no-indexes` and normal dumps with `--trace`, verified that cache and index (former case) or cache only (latter case) tables were dumped with `--no-data`.
  - Verified dump has the same number of `CREATE TABLE` statements as before the changes.
  - Reviewed persistence tags in the web UI (note Ferret engine tables are "Index"):

{F5210886}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13000

Differential Revision: https://secure.phabricator.com/D18682
2017-10-04 12:09:33 -07:00

67 lines
1.6 KiB
PHP

<?php
final class DifferentialSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildEdgeSchemata(new DifferentialRevision());
$this->buildRawSchema(
id(new DifferentialRevision())->getApplicationName(),
DifferentialChangeset::TABLE_CACHE,
array(
'id' => 'id',
'cache' => 'bytes',
'dateCreated' => 'epoch',
),
array(
'PRIMARY' => array(
'columns' => array('id'),
'unique' => true,
),
'dateCreated' => array(
'columns' => array('dateCreated'),
),
),
array(
'persistence' => PhabricatorConfigTableSchema::PERSISTENCE_CACHE,
));
$this->buildRawSchema(
id(new DifferentialRevision())->getApplicationName(),
DifferentialRevision::TABLE_COMMIT,
array(
'revisionID' => 'id',
'commitPHID' => 'phid',
),
array(
'PRIMARY' => array(
'columns' => array('revisionID', 'commitPHID'),
'unique' => true,
),
'commitPHID' => array(
'columns' => array('commitPHID'),
'unique' => true,
),
));
$this->buildRawSchema(
id(new DifferentialRevision())->getApplicationName(),
ArcanistDifferentialRevisionHash::TABLE_NAME,
array(
'revisionID' => 'id',
'type' => 'bytes4',
'hash' => 'bytes40',
),
array(
'type' => array(
'columns' => array('type', 'hash'),
),
'revisionID' => array(
'columns' => array('revisionID'),
),
));
}
}