From 183bb8c80ff1777bc86648dd65d5d0a759f5cc37 Mon Sep 17 00:00:00 2001 From: Gareth Evans Date: Thu, 23 May 2013 09:22:18 -0700 Subject: [PATCH] Stop writing empty strings to the ownerPHID column Summary: If we're unassigning an owner from a task it should set the column to `NULL` rather than an empty string. Fixes T3239 Test Plan: Assigned and Unassigned a task. Make sure the db is doing as excpected. Ran the patch, checked the db. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3239 Differential Revision: https://secure.phabricator.com/D6017 --- resources/sql/patches/20130523.maniphest_owners.sql | 1 + src/applications/maniphest/storage/ManiphestTask.php | 2 +- .../storage/patch/PhabricatorBuiltinPatchList.php | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 resources/sql/patches/20130523.maniphest_owners.sql diff --git a/resources/sql/patches/20130523.maniphest_owners.sql b/resources/sql/patches/20130523.maniphest_owners.sql new file mode 100644 index 0000000000..d5209e2b35 --- /dev/null +++ b/resources/sql/patches/20130523.maniphest_owners.sql @@ -0,0 +1 @@ +update {$NAMESPACE}_maniphest.maniphest_task set ownerPHID = NULL WHERE ownerPHID = ''; diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index c20172b268..4c3d83ec2b 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -90,7 +90,7 @@ final class ManiphestTask extends ManiphestDAO } public function setOwnerPHID($phid) { - $this->ownerPHID = $phid; + $this->ownerPHID = nonempty($phid, null); $this->subscribersNeedUpdate = true; return $this; } diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php index b6d5a23bcd..a67d63211a 100644 --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -1310,6 +1310,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'sql', 'name' => $this->getPatchPath('20130521.dropconphimages.sql'), ), + '20130523.maniphest_owners.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20130523.maniphest_owners.sql'), + ), ); }