diff --git a/resources/sql/autopatches/20180828.phriction.06.c.documentid.php b/resources/sql/autopatches/20180828.phriction.06.c.documentid.php new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20180828.phriction.06.c.documentid.php @@ -0,0 +1,20 @@ +establishConnection('w'); + +try { + queryfx( + $conn, + 'ALTER TABLE %T DROP KEY documentID', + $table->getTableName()); +} catch (AphrontQueryException $ex) { + // Ignore. +} diff --git a/resources/sql/autopatches/20180828.phriction.07.documentkey.sql b/resources/sql/autopatches/20180828.phriction.07.documentkey.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20180828.phriction.07.documentkey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_phriction.phriction_content + ADD UNIQUE KEY `key_version` (documentPHID, version); diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php --- a/src/applications/phriction/storage/PhrictionContent.php +++ b/src/applications/phriction/storage/PhrictionContent.php @@ -34,7 +34,7 @@ 'description' => 'text', ), self::CONFIG_KEY_SCHEMA => array( - 'documentID' => array( + 'key_version' => array( 'columns' => array('documentPHID', 'version'), 'unique' => true, ),