Просмотр файла database/upgrades/2025_07_17_043631_add_active_and_published_at_to_articles.php

Размер файла: 639B
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        Schema::table('articles', function (Blueprint $table) {
            $table->timestamp('published_at')->nullable()->after('count_comments');
            $table->boolean('active')->default(true)->after('count_comments');
        });
    }

    public function down(): void
    {
        Schema::table('articles', function (Blueprint $table) {
            $table->dropColumn(['active', 'published_at']);
        });
    }
};