From b1c4a258c98f5339abeb1f882545de36df02ba30 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 2 Aug 2013 08:28:55 -0700 Subject: [PATCH] Add ApplicationTransactions to Herald Summary: Ref T2769. I'm planning to keep this pretty simple, but we have this ad-hoc edit log for rules already and some other mess that we can clean up. Test Plan: No effect yet; see future changes. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2769 Differential Revision: https://secure.phabricator.com/D6654 --- .../sql/patches/20130802.heraldxactions.sql | 40 +++++++++++++++++++ src/__phutil_library_map__.php | 4 ++ .../herald/storage/HeraldRuleTransaction.php | 25 ++++++++++++ .../storage/HeraldRuleTransactionComment.php | 11 +++++ .../patch/PhabricatorBuiltinPatchList.php | 4 ++ 5 files changed, 84 insertions(+) create mode 100644 resources/sql/patches/20130802.heraldxactions.sql create mode 100644 src/applications/herald/storage/HeraldRuleTransaction.php create mode 100644 src/applications/herald/storage/HeraldRuleTransactionComment.php diff --git a/resources/sql/patches/20130802.heraldxactions.sql b/resources/sql/patches/20130802.heraldxactions.sql new file mode 100644 index 0000000000..8bfd947a55 --- /dev/null +++ b/resources/sql/patches/20130802.heraldxactions.sql @@ -0,0 +1,40 @@ +CREATE TABLE {$NAMESPACE}_herald.herald_ruletransaction ( + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + phid VARCHAR(64) NOT NULL COLLATE utf8_bin, + authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, + objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, + viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin, + editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin, + commentPHID VARCHAR(64) COLLATE utf8_bin, + commentVersion INT UNSIGNED NOT NULL, + transactionType VARCHAR(32) NOT NULL COLLATE utf8_bin, + oldValue LONGTEXT NOT NULL COLLATE utf8_bin, + newValue LONGTEXT NOT NULL COLLATE utf8_bin, + contentSource LONGTEXT NOT NULL COLLATE utf8_bin, + metadata LONGTEXT NOT NULL COLLATE utf8_bin, + dateCreated INT UNSIGNED NOT NULL, + dateModified INT UNSIGNED NOT NULL, + + UNIQUE KEY `key_phid` (phid), + KEY `key_object` (objectPHID) + +) ENGINE=InnoDB, COLLATE utf8_general_ci; + +CREATE TABLE {$NAMESPACE}_herald.herald_ruletransaction_comment ( + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + phid VARCHAR(64) NOT NULL COLLATE utf8_bin, + transactionPHID VARCHAR(64) COLLATE utf8_bin, + authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, + viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin, + editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin, + commentVersion INT UNSIGNED NOT NULL, + content LONGTEXT NOT NULL COLLATE utf8_bin, + contentSource LONGTEXT NOT NULL COLLATE utf8_bin, + isDeleted BOOL NOT NULL, + dateCreated INT UNSIGNED NOT NULL, + dateModified INT UNSIGNED NOT NULL, + + UNIQUE KEY `key_phid` (phid), + UNIQUE KEY `key_version` (transactionPHID, commentVersion) + +) ENGINE=InnoDB, COLLATE utf8_general_ci; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 97c4d3d407..9d45676c75 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -627,6 +627,8 @@ phutil_register_library_map(array( 'HeraldRuleListController' => 'applications/herald/controller/HeraldRuleListController.php', 'HeraldRuleQuery' => 'applications/herald/query/HeraldRuleQuery.php', 'HeraldRuleSearchEngine' => 'applications/herald/query/HeraldRuleSearchEngine.php', + 'HeraldRuleTransaction' => 'applications/herald/storage/HeraldRuleTransaction.php', + 'HeraldRuleTransactionComment' => 'applications/herald/storage/HeraldRuleTransactionComment.php', 'HeraldRuleTranscript' => 'applications/herald/storage/transcript/HeraldRuleTranscript.php', 'HeraldRuleTypeConfig' => 'applications/herald/config/HeraldRuleTypeConfig.php', 'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php', @@ -2639,6 +2641,8 @@ phutil_register_library_map(array( ), 'HeraldRuleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HeraldRuleSearchEngine' => 'PhabricatorApplicationSearchEngine', + 'HeraldRuleTransaction' => 'PhabricatorApplicationTransaction', + 'HeraldRuleTransactionComment' => 'PhabricatorApplicationTransactionComment', 'HeraldTestConsoleController' => 'HeraldController', 'HeraldTranscript' => 'HeraldDAO', 'HeraldTranscriptController' => 'HeraldController', diff --git a/src/applications/herald/storage/HeraldRuleTransaction.php b/src/applications/herald/storage/HeraldRuleTransaction.php new file mode 100644 index 0000000000..7b0ee05bf8 --- /dev/null +++ b/src/applications/herald/storage/HeraldRuleTransaction.php @@ -0,0 +1,25 @@ + 'sql', 'name' => $this->getPatchPath('20130802.heraldphidukey.sql'), ), + '20130802.heraldxactions.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20130802.heraldxactions.sql'), + ), ); } }