1
0
mirror of https://github.com/flarum/core.git synced 2025-08-12 11:24:30 +02:00

Use dependency injection in migrations

This commit is contained in:
Franz Liedke
2015-08-12 01:29:40 +02:00
parent 9762e20be1
commit 7b07e02e75
14 changed files with 57 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
<?php
use Flarum\Install\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class CreatePostsTable extends Migration
@@ -14,7 +14,7 @@ class CreatePostsTable extends Migration
*/
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$this->schema->create('posts', function (Blueprint $table) {
$table->increments('id');
$table->integer('discussion_id')->unsigned();
$table->integer('number')->unsigned()->nullable();
@@ -34,7 +34,8 @@ class CreatePostsTable extends Migration
$table->engine = 'MyISAM';
});
app('db')->statement('ALTER TABLE posts ADD FULLTEXT content (content)');
$prefix = $this->schema->getConnection()->getTablePrefix();
$this->schema->getConnection()->statement('ALTER TABLE '.$prefix.'posts ADD FULLTEXT content (content)');
}
/**
@@ -44,6 +45,6 @@ class CreatePostsTable extends Migration
*/
public function down()
{
Schema::drop('posts');
$this->schema->drop('posts');
}
}