Workaround for index setup on SubMirror until I'm done w/ arbitrary index support for Schema setup.
This commit is contained in:
parent
09dee24cbe
commit
6a2659ed67
|
@ -333,7 +333,7 @@ class MysqlSchema extends Schema
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
$name = "$table_".implode("_", $columnNames)."_idx";
|
$name = "{$table}_".implode("_", $columnNames)."_idx";
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $this->conn->query("ALTER TABLE $table ".
|
$res = $this->conn->query("ALTER TABLE $table ".
|
||||||
|
|
|
@ -120,6 +120,9 @@ class SubMirrorPlugin extends Plugin
|
||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
$schema->ensureTable('submirror', SubMirror::schemaDef());
|
$schema->ensureTable('submirror', SubMirror::schemaDef());
|
||||||
|
|
||||||
|
// @hack until key definition support is merged
|
||||||
|
SubMirror::fixIndexes($schema);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,22 @@ class SubMirror extends Memcached_DataObject
|
||||||
null, false));
|
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
|
* return key definitions for DB_DataObject
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user