First Commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddAllowCommentsToContentTables
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if (Capsule::schema()->hasTable('blog_posts')) {
|
||||
if (!Capsule::schema()->hasColumn('blog_posts', 'posts_allow_comments')) {
|
||||
Capsule::schema()->table('blog_posts', function (Blueprint $table) {
|
||||
$table->boolean('posts_allow_comments')->default(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Capsule::schema()->hasTable('news')) {
|
||||
if (!Capsule::schema()->hasColumn('news', 'news_allow_comments')) {
|
||||
Capsule::schema()->table('news', function (Blueprint $table) {
|
||||
$table->boolean('news_allow_comments')->default(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Capsule::schema()->hasTable('photos_albums')) {
|
||||
if (!Capsule::schema()->hasColumn('photos_albums', 'photos_albums_allow_comments')) {
|
||||
Capsule::schema()->table('photos_albums', function (Blueprint $table) {
|
||||
$table->boolean('photos_albums_allow_comments')->default(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if (Capsule::schema()->hasTable('blog_posts')) {
|
||||
Capsule::schema()->table('blog_posts', function (Blueprint $table) {
|
||||
$table->dropColumn('posts_allow_comments');
|
||||
});
|
||||
}
|
||||
|
||||
if (Capsule::schema()->hasTable('news')) {
|
||||
Capsule::schema()->table('news', function (Blueprint $table) {
|
||||
$table->dropColumn('news_allow_comments');
|
||||
});
|
||||
}
|
||||
|
||||
if (Capsule::schema()->hasTable('photos_albums')) {
|
||||
Capsule::schema()->table('photos_albums', function (Blueprint $table) {
|
||||
$table->dropColumn('photos_albums_allow_comments');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user