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

32 lines
732 B
PHP

<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
use RainLab\Blog\Models\Category as CategoryModel;
class PostsAddMetadata 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();
});
}
public function down()
{
if (Schema::hasColumn('rainlab_blog_posts', 'metadata')) {
Schema::table('rainlab_blog_posts', function ($table) {
$table->dropColumn('featured_image');
});
}
}
}