31 lines
754 B
PHP
Executable File
31 lines
754 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
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
// Add answer_id to make unique answer per question
|
|
Schema::table('question_answers', function (Blueprint $table) {
|
|
$table->unsignedBigInteger('answer_id')->after('survey_id'); // answer_id
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
// remove answer_id
|
|
Schema::table('question_answers', function (Blueprint $table) {
|
|
$table->dropColumn('answer_id'); // answer_id
|
|
});
|
|
}
|
|
};
|