mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
reverts #41688c7
This commit is contained in:
@@ -31,8 +31,6 @@ abstract class Migration
|
||||
'up' => function (Builder $schema) use ($name, $definition) {
|
||||
$schema->create($name, function (Blueprint $table) use ($schema, $definition) {
|
||||
$definition($table);
|
||||
|
||||
static::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
'down' => function (Builder $schema) use ($name) {
|
||||
@@ -68,8 +66,6 @@ abstract class Migration
|
||||
$type = array_shift($options);
|
||||
$table->addColumn($type, $columnName, $options);
|
||||
}
|
||||
|
||||
Migration::fixIndexNames($schema, $table);
|
||||
});
|
||||
},
|
||||
'down' => function (Builder $schema) use ($tableName, $columnDefinitions) {
|
||||
@@ -193,27 +189,4 @@ abstract class Migration
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a prefix to index names on the given table blueprint.
|
||||
*
|
||||
* Laravel 5.5 doesn't automatically add the table prefix to index
|
||||
* names, but this has been fixed in 5.7. We will manually fix the
|
||||
* names for now, and we can remove this when we upgrade to 5.7.
|
||||
*/
|
||||
public static function fixIndexNames(Builder $schema, Blueprint $table)
|
||||
{
|
||||
$indexCommands = [
|
||||
'unique', 'index', 'spatialIndex', 'foreign',
|
||||
'dropUnique', 'dropIndex', 'dropSpatialIndex', 'dropForeign'
|
||||
];
|
||||
|
||||
$prefix = $schema->getConnection()->getTablePrefix();
|
||||
|
||||
foreach ($table->getCommands() as $command) {
|
||||
if (in_array($command->name, $indexCommands)) {
|
||||
$command->index = $prefix.$command->index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user