-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
I found that in the quiz_questions a unique constraint is set on quiz_id and question_id.
2021_05_22_053359_create_quizzes_table.php
// Quiz Questions Table
Schema::create($this->tableNames['quiz_questions'], function (Blueprint $table) {
$table->id();
$table->foreignId('quiz_id')->nullable()->constrained($this->tableNames['quizzes'])->cascadeOnDelete();
$table->foreignId('question_id')->nullable()->constrained($this->tableNames['questions'])->cascadeOnDelete();
$table->unsignedFloat('marks')->default(0); //0 means no marks
$table->unsignedFloat('negative_marks')->default(0); //0 means no negative marks in case of wrong answer
$table->boolean('is_optional')->default(false); //0 means not optional, 1 means optional
$table->unsignedInteger('order')->default(0);
$table->timestamps();
$table->softDeletes();
$table->unique(['quiz_id', 'question_id']);
});
When a question is deleted by mistake it cannot be added anymore. I guess it would make sense to remove the unique constraint and handle this also with the validation. What do you think?
Metadata
Metadata
Assignees
Labels
No labels