Files
LMS/database/migrations/2024_01_03_000002_create_questions_table.php
T
mirivladandQwen-Coder 025b03c94b Refactor: Убран single_choice (частный случай multiple_choice)
 Все single_choice конвертированы в multiple_choice
 Отображение (radio/checkbox) зависит от кол-ва правильных ответов:
   - 1 правильный → radio (bi-circle)
   - 2+ правильных → checkbox (bi-check2-square)
 Обновлены миграции
 Обновлены view файлы

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-27 09:55:33 +08:00

32 lines
976 B
PHP
Executable File

<?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('questions', function (Blueprint $table) {
$table->id();
$table->foreignId('test_id')->constrained()->onDelete('cascade');
$table->enum('type', ['multiple_choice', 'matching', 'ordering'])->default('multiple_choice');
$table->text('question_text');
$table->text('explanation')->nullable();
$table->integer('score')->default(1);
$table->integer('sort_order')->default(0);
$table->boolean('is_required')->default(true);
$table->timestamps();
$table->index('test_id');
$table->index('type');
});
}
public function down(): void
{
Schema::dropIfExists('questions');
}
};