From 875b86671566a994f899777a06f401ba1d56297d Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 17 May 2016 04:51:16 -0700 Subject: [PATCH] Add missing "oauth_server_edge" tables Summary: Fixes T10975. The "scramble attached file permissions when an object is saved" code is misfiring here too. See T10778 + D15803 for prior work. Test Plan: - Ran `bin/storage upgrade -f`. - Edited the view policy of an OAuth server (prepatch: fatal; postpatch: worked great). Reviewers: chad Reviewed By: chad Maniphest Tasks: T10975 Differential Revision: https://secure.phabricator.com/D15938 --- .../sql/autopatches/20160517.oauth.01.edge.sql | 16 ++++++++++++++++ src/__phutil_library_map__.php | 2 ++ .../query/PhabricatorOAuthServerSchemaSpec.php | 10 ++++++++++ 3 files changed, 28 insertions(+) create mode 100644 resources/sql/autopatches/20160517.oauth.01.edge.sql create mode 100644 src/applications/oauthserver/query/PhabricatorOAuthServerSchemaSpec.php diff --git a/resources/sql/autopatches/20160517.oauth.01.edge.sql b/resources/sql/autopatches/20160517.oauth.01.edge.sql new file mode 100644 index 0000000000..7881d89251 --- /dev/null +++ b/resources/sql/autopatches/20160517.oauth.01.edge.sql @@ -0,0 +1,16 @@ +CREATE TABLE {$NAMESPACE}_oauth_server.edge ( + src VARBINARY(64) NOT NULL, + type INT UNSIGNED NOT NULL, + dst VARBINARY(64) NOT NULL, + dateCreated INT UNSIGNED NOT NULL, + seq INT UNSIGNED NOT NULL, + dataID INT UNSIGNED, + PRIMARY KEY (src, type, dst), + KEY `src` (src, type, dateCreated, seq), + UNIQUE KEY `key_dst` (dst, type, src) +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; + +CREATE TABLE {$NAMESPACE}_oauth_server.edgedata ( + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, + data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT} +) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c005fe27bf..64b850fa1e 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2783,6 +2783,7 @@ phutil_register_library_map(array( 'PhabricatorOAuthServerDAO' => 'applications/oauthserver/storage/PhabricatorOAuthServerDAO.php', 'PhabricatorOAuthServerEditEngine' => 'applications/oauthserver/editor/PhabricatorOAuthServerEditEngine.php', 'PhabricatorOAuthServerEditor' => 'applications/oauthserver/editor/PhabricatorOAuthServerEditor.php', + 'PhabricatorOAuthServerSchemaSpec' => 'applications/oauthserver/query/PhabricatorOAuthServerSchemaSpec.php', 'PhabricatorOAuthServerScope' => 'applications/oauthserver/PhabricatorOAuthServerScope.php', 'PhabricatorOAuthServerTestCase' => 'applications/oauthserver/__tests__/PhabricatorOAuthServerTestCase.php', 'PhabricatorOAuthServerTokenController' => 'applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php', @@ -7352,6 +7353,7 @@ phutil_register_library_map(array( 'PhabricatorOAuthServerDAO' => 'PhabricatorLiskDAO', 'PhabricatorOAuthServerEditEngine' => 'PhabricatorEditEngine', 'PhabricatorOAuthServerEditor' => 'PhabricatorApplicationTransactionEditor', + 'PhabricatorOAuthServerSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorOAuthServerScope' => 'Phobject', 'PhabricatorOAuthServerTestCase' => 'PhabricatorTestCase', 'PhabricatorOAuthServerTokenController' => 'PhabricatorOAuthServerController', diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerSchemaSpec.php b/src/applications/oauthserver/query/PhabricatorOAuthServerSchemaSpec.php new file mode 100644 index 0000000000..49c2498d02 --- /dev/null +++ b/src/applications/oauthserver/query/PhabricatorOAuthServerSchemaSpec.php @@ -0,0 +1,10 @@ +buildEdgeSchemata(new PhabricatorOAuthServerClient()); + } + +}