| @@ 6-32 (lines=27) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreatePostTagTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('blog__post_tag', function (Blueprint $table) { |
|
| 16 | $table->engine = 'InnoDB'; |
|
| 17 | $table->integer('tag_id'); |
|
| 18 | $table->integer('post_id'); |
|
| 19 | $table->timestamps(); |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Reverse the migrations. |
|
| 25 | * |
|
| 26 | * @return void |
|
| 27 | */ |
|
| 28 | public function down() |
|
| 29 | { |
|
| 30 | Schema::drop('blog__post_tag'); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 6-30 (lines=25) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class AddStatusColumnToPostTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * @return void |
|
| 11 | */ |
|
| 12 | public function up() |
|
| 13 | { |
|
| 14 | Schema::table('blog__posts', function (Blueprint $table) { |
|
| 15 | $table->engine = 'InnoDB'; |
|
| 16 | $table->integer('status')->after('category_id'); |
|
| 17 | }); |
|
| 18 | } |
|
| 19 | ||
| 20 | /** |
|
| 21 | * Reverse the migrations. |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | public function down() |
|
| 25 | { |
|
| 26 | Schema::table('blog__posts', function (Blueprint $table) { |
|
| 27 | $table->dropColumn('status'); |
|
| 28 | }); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| @@ 6-33 (lines=28) @@ | ||
| 3 | use Illuminate\Database\Schema\Blueprint; |
|
| 4 | use Illuminate\Database\Migrations\Migration; |
|
| 5 | ||
| 6 | class AddLanguageToPosts extends Migration |
|
| 7 | { |
|
| 8 | ||
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::table('blog__posts', function (Blueprint $table) { |
|
| 17 | $table->string('locale', 3)->after('status'); |
|
| 18 | }); |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Reverse the migrations. |
|
| 23 | * |
|
| 24 | * @return void |
|
| 25 | */ |
|
| 26 | public function down() |
|
| 27 | { |
|
| 28 | Schema::table('blog__posts', function (Blueprint $table) { |
|
| 29 | $table->dropColumn('locale'); |
|
| 30 | }); |
|
| 31 | } |
|
| 32 | ||
| 33 | } |
|
| 34 | ||