<?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::create('quizzes', function (Blueprint $table) {
   $table->id();
   $table->foreignId('training_class_id')->constrained('training_classes')->cascadeOnDelete();
   $table->string('title');
   $table->text('description')->nullable();
   $table->integer('duration_minutes')->default(30);
   $table->decimal('max_score',6,2)->default(10);
   $table->decimal('pass_score',6,2)->default(5);
   $table->integer('attempt_limit')->default(1);
   $table->string('status')->default('Đang mở');
   $table->date('start_date')->nullable();
   $table->date('end_date')->nullable();
   $table->timestamps();
  });
 }
 public function down(): void { Schema::dropIfExists('quizzes'); }
};
