path: root/classes/File.php
diff options
authorMikael Nordfeldth <mmn@hethane.se>2015-02-19 21:21:39 +0100
committerMikael Nordfeldth <mmn@hethane.se>2015-02-19 21:21:39 +0100
commitb54710950f3cfb01f0867e20e4da9e20448d802d (patch)
tree4859e4a491dc22614974f8feb5626907a9221af0 /classes/File.php
parentd061e1065eb3c3d1bf330ae584e85338470c7f84 (diff)
unique keys and indexes must be NOT NULL or MySQL fucks up
If this merge throws exception on scripts/upgrade.php and you recently tried a nightly (i.e. during 2015-02-19) then just go back a commit or two and try again. Or delete the duplicate entries. Find the entries like this: SELECT COUNT(*), urlhash FROM file_redirection GROUP BY urlhash HAVING COUNT(*) > 1; then for each urlhash (or come up with a smart SQL query) do: DELETE FROM file_redirection WHERE urlhash='hashfrompreviousquery' LIMIT 1; You'll have to remove duplicates more than once if you have >2 identical urlhash entries. LIMIT -1 might do that for you. I'm not sure.
Diffstat (limited to 'classes/File.php')
1 files changed, 1 insertions, 1 deletions
diff --git a/classes/File.php b/classes/File.php
index b4bf9f9a1f..c7239777ea 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -45,7 +45,7 @@ class File extends Managed_DataObject
return array(
'fields' => array(
'id' => array('type' => 'serial', 'not null' => true),
- 'urlhash' => array('type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'),
+ 'urlhash' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'sha256 of destination URL (url field)'),
'url' => array('type' => 'text', 'description' => 'destination URL after following redirections'),
'mimetype' => array('type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'),
'size' => array('type' => 'int', 'description' => 'size of resource when available'),