1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 08:20:57 +01:00

Work-in-progress schema for Facts app

Summary: See discussion in D3078 for why I've separated this. Pretty sure it's not quite ready yet -- I want to build a couple of things on it so we have a better idea of what we need (autoincrement ID? <factType, objectA, epoch> primary key? objectB column? valueZ?) and don't need to do a ton of schema patches.

Test Plan: Applied patches, ran D3078.

Reviewers: vrana, btrahan, majak

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1581, T1562

Differential Revision: https://secure.phabricator.com/D3088
This commit is contained in:
epriestley 2012-08-09 08:40:56 -07:00
parent 85672346bc
commit d32926e5f7
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,28 @@
CREATE TABLE {$NAMESPACE}_fact.fact_raw (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`factType` VARCHAR(32) NOT NULL COLLATE utf8_bin,
`objectPHID` VARCHAR(64) NOT NULL COLLATE utf8_bin,
`objectA` VARCHAR(64) NOT NULL COLLATE utf8_bin,
`valueX` BIGINT NOT NULL,
`valueY` BIGINT NOT NULL,
`epoch` INT UNSIGNED NOT NULL,
KEY (objectPHID),
KEY (factType, epoch),
KEY (factType, objectA, epoch)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_fact.fact_aggregate (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`factType` VARCHAR(32) NOT NULL COLLATE utf8_bin,
`objectPHID` VARCHAR(64) NOT NULL COLLATE utf8_bin,
`valueX` BIGINT NOT NULL,
UNIQUE KEY (factType, objectPHID),
KEY (factType, valueX)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_fact.fact_cursor (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(64) NOT NULL COLLATE utf8_bin,
`position` VARCHAR(64) NOT NULL COLLATE utf8_bin,
UNIQUE KEY (name)
) ENGINE=InnoDB, COLLATE utf8_general_ci;

View file

@ -159,6 +159,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'db',
'name' => 'cache',
),
'db.fact' => array(
'type' => 'db',
'name' => 'fact',
),
'0000.legacy.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('0000.legacy.sql'),
@ -944,6 +948,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'php',
'name' => $this->getPatchPath('migrate-project-edges.php'),
),
'fact-raw.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('fact-raw.sql'),
),
);
}