ORIENT/plugins/rainlab/blog/updates/posts_add_featured_image.php

37 lines
1.0 KiB
PHP

<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
use RainLab\Blog\Models\Category as CategoryModel;
class PostsAddImage extends Migration
{
public function up()
{
if (Schema::hasColumn('rainlab_blog_posts', 'featured_image')) {
return;
}
Schema::table('rainlab_blog_posts', function($table)
{
$table->string('featured_image')->nullable();
$table->string('locale')->nullable();
$table->integer('id_ru')->unsigned()->nullable();
$table->integer('id_en')->unsigned()->nullable();
});
}
public function down()
{
if (Schema::hasColumn('rainlab_blog_posts', 'featured_image')) {
Schema::table('rainlab_blog_posts', function ($table) {
$table->dropColumn('featured_image');
$table->dropColumn('locale');
$table->dropColumn('id_ru');
$table->dropColumn('id_en');
});
}
}
}