1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00
phorge-phorge/resources/sql/patches/20130622.doorkeeper.sql
epriestley f54a5d8087 Add DoorkeeperExternalObject
Summary:
Ref T2852. This table holds data about external objects and allows us to write edges to them.

Objects are identified with an `<applicationType, applicationDomain, objectType, objectID>` tuple. For example, Asana tasks will be, e.g., `<asana, asana.com, asana:task, 93829279873>` or similar.

Test Plan: Ran storage upgrade.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

Differential Revision: https://secure.phabricator.com/D6271
2013-06-24 15:54:36 -07:00

35 lines
1.4 KiB
SQL

CREATE TABLE {$NAMESPACE}_doorkeeper.doorkeeper_externalobject (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
objectKey CHAR(12) NOT NULL COLLATE utf8_bin,
applicationType VARCHAR(32) NOT NULL COLLATE utf8_bin,
applicationDomain VARCHAR(32) NOT NULL COLLATE utf8_bin,
objectType VARCHAR(32) NOT NULL COLLATE utf8_bin,
objectID VARCHAR(64) NOT NULL COLLATE utf8_bin,
objectURI VARCHAR(128) COLLATE utf8_bin,
importerPHID VARCHAR(64) COLLATE utf8_bin,
properties LONGTEXT NOT NULL COLLATE utf8_bin,
viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (phid),
UNIQUE KEY `key_object` (objectKey),
KEY `key_full` (applicationType, applicationDomain, objectType, objectID)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_doorkeeper.edge (
src VARCHAR(64) NOT NULL COLLATE utf8_bin,
type INT UNSIGNED NOT NULL COLLATE utf8_bin,
dst VARCHAR(64) NOT NULL COLLATE utf8_bin,
dateCreated INT UNSIGNED NOT NULL,
seq INT UNSIGNED NOT NULL,
dataID INT UNSIGNED,
PRIMARY KEY (src, type, dst),
KEY (src, type, dateCreated, seq)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_doorkeeper.edgedata (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
data LONGTEXT NOT NULL COLLATE utf8_bin
) ENGINE=InnoDB, COLLATE utf8_general_ci;