]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Workaround for index setup on SubMirror until I'm done w/ arbitrary index support...
authorBrion Vibber <brion@status.net>
Tue, 10 Aug 2010 18:45:34 +0000 (11:45 -0700)
committerBrion Vibber <brion@status.net>
Tue, 10 Aug 2010 18:45:34 +0000 (11:45 -0700)
lib/mysqlschema.php
plugins/SubMirror/SubMirrorPlugin.php
plugins/SubMirror/classes/SubMirror.php

index 464c718f99754da08809b9f356d1f29c37a57f93..f9552c1dcdefd5cef37c8d6ad69ab59aaf18cb2a 100644 (file)
@@ -333,7 +333,7 @@ class MysqlSchema extends Schema
         }
 
         if (empty($name)) {
-            $name = "$table_".implode("_", $columnNames)."_idx";
+            $name = "{$table}_".implode("_", $columnNames)."_idx";
         }
 
         $res = $this->conn->query("ALTER TABLE $table ".
index 7289e77938c90cb48f0b475b5a8c5a540617ce33..80c6c5a88f824b8bf210d1865e8454f56294b7da 100644 (file)
@@ -120,6 +120,9 @@ class SubMirrorPlugin extends Plugin
     {
         $schema = Schema::get();
         $schema->ensureTable('submirror', SubMirror::schemaDef());
+
+        // @hack until key definition support is merged
+        SubMirror::fixIndexes($schema);
         return true;
     }
 
index 4e7e005db261d637742711074151113c9b6c1747..bd8fc80a5fbc0fb3a46c6398a4e005c2b369d580 100644 (file)
@@ -76,6 +76,22 @@ class SubMirror extends Memcached_DataObject
                                    null, false));
     }
 
+    /**
+     * Temporary hack to set up the compound index, since we can't do
+     * it yet through regular Schema interface. (Coming for 1.0...)
+     * 
+     * @param Schema $schema
+     * @return void
+     */
+    static function fixIndexes($schema)
+    {
+        try {
+            $schema->createIndex('submirror', array('subscribed', 'subscriber'));
+        } catch (Exception $e) {
+            common_log(LOG_ERR, __METHOD__ . ': ' . $e->getMessage());
+        }
+    }
+
     /**
      * return key definitions for DB_DataObject
      *