mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 17:30:59 +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:
parent
85672346bc
commit
d32926e5f7
2 changed files with 36 additions and 0 deletions
28
resources/sql/patches/fact-raw.sql
Normal file
28
resources/sql/patches/fact-raw.sql
Normal 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;
|
|
@ -159,6 +159,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
|
||||||
'type' => 'db',
|
'type' => 'db',
|
||||||
'name' => 'cache',
|
'name' => 'cache',
|
||||||
),
|
),
|
||||||
|
'db.fact' => array(
|
||||||
|
'type' => 'db',
|
||||||
|
'name' => 'fact',
|
||||||
|
),
|
||||||
'0000.legacy.sql' => array(
|
'0000.legacy.sql' => array(
|
||||||
'type' => 'sql',
|
'type' => 'sql',
|
||||||
'name' => $this->getPatchPath('0000.legacy.sql'),
|
'name' => $this->getPatchPath('0000.legacy.sql'),
|
||||||
|
@ -944,6 +948,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
|
||||||
'type' => 'php',
|
'type' => 'php',
|
||||||
'name' => $this->getPatchPath('migrate-project-edges.php'),
|
'name' => $this->getPatchPath('migrate-project-edges.php'),
|
||||||
),
|
),
|
||||||
|
'fact-raw.sql' => array(
|
||||||
|
'type' => 'sql',
|
||||||
|
'name' => $this->getPatchPath('fact-raw.sql'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue