Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // database/migrations/2025_08_03_000003_create_articles_table.php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class CreateArticlesTable extends Migration
- {
- public function up()
- {
- Schema::create('articles', function (Blueprint $table) {
- $table->id();
- $table->string('title');
- $table->text('content');
- $table->foreignId('category_id')->constrained()->onDelete('cascade');
- $table->foreignId('level_id')->constrained()->onDelete('cascade');
- $table->timestamps();
- });
- }
- public function down()
- {
- Schema::dropIfExists('articles');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment