Skip to content

Commit

Permalink
revert the fix index names logic, preparing for illuminate 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
luceos committed Jan 15, 2019
1 parent 2f3417b commit bd00270
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/

use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;

Expand All @@ -31,20 +30,16 @@
})
->update(['user_id' => null]);

$schema->table('flags', function (Blueprint $table) use ($schema) {
$schema->table('flags', function (Blueprint $table) {
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

Migration::fixIndexNames($schema, $table);
});
},

'down' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) {
$schema->table('flags', function (Blueprint $table) {
$table->dropForeign(['post_id']);
$table->dropForeign(['user_id']);

Migration::fixIndexNames($schema, $table);
});
}
];
9 changes: 2 additions & 7 deletions migrations/2018_09_15_043621_add_flags_indices.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,19 @@
* file that was distributed with this source code.
*/

use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;

return [
'up' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) {
$schema->table('flags', function (Blueprint $table) {
$table->index('created_at');

Migration::fixIndexNames($schema, $table);
});
},

'down' => function (Builder $schema) {
$schema->table('flags', function (Blueprint $table) use ($schema) {
$schema->table('flags', function (Blueprint $table) {
$table->dropIndex(['created_at']);

Migration::fixIndexNames($schema, $table);
});
}
];

0 comments on commit bd00270

Please sign in to comment.