1
0
tinklu-it-projektas/database/migrations/2023_10_29_172100_create_questions_table.php

32 lines
837 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('questions', function (Blueprint $table) {
$table->id();
$table->foreignId("test_id")->references("id")->on("tests")->constrained()->cascadeOnDelete();
$table->string("question");
$table->enum("answer_type", ["single_answer", "single_choice", "multiple_choice"]);
$table->unsignedInteger("points")->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('questions');
}
};