Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14406175
D19624.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D19624.diff
View Options
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 @@
+<?php
+
+// See T13193. We're about to drop the "documentID" column, which is part of
+// a UNIQUE KEY. In MariaDB, we must first drop the "documentID" key or we get
+// into deep trouble.
+
+// There's no "IF EXISTS" modifier for "ALTER TABLE" so run this as a PHP patch
+// instead of an SQL patch.
+
+$table = new PhrictionContent();
+$conn = $table->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,
),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 9:53 AM (19 h, 33 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6923488
Default Alt Text
D19624.diff (1 KB)
Attached To
Mode
D19624: Work around an issue in MariaDB where dropping a column from a UNIQUE KEY fails
Attached
Detach File
Event Timeline
Log In to Comment