1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00
phorge-phorge/resources/sql/patches/fact-raw.sql
epriestley d32926e5f7 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
2012-08-09 08:40:56 -07:00

28 lines
1.1 KiB
SQL

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;