initial commit
This commit is contained in:
76
database/migrations/2024_03_22_203406_delete_tabel.php
Normal file
76
database/migrations/2024_03_22_203406_delete_tabel.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?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::dropIfExists('profile_answers');
|
||||
Schema::dropIfExists('profile_questions');
|
||||
Schema::dropIfExists('profile_groups');
|
||||
Schema::dropIfExists('profile_categories');
|
||||
|
||||
|
||||
Schema::create('profile_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('status')->nullable();
|
||||
$table->string('icon')->nullable(); // Allow for optional icons
|
||||
$table->softDeletes(); // For soft deletion
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('profile_questions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->timestamps();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->foreign('category_id')->references('id')->on('profile_categories');
|
||||
$table->text('question')->nullable();
|
||||
$table->string('question_type')->nullable();
|
||||
$table->string('question_options')->nullable();
|
||||
});
|
||||
Schema::create('profile_sub_questions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->timestamps();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->foreign('category_id')->references('id')->on('profile_categories');
|
||||
$table->unsignedBigInteger('question_id')->nullable();
|
||||
$table->foreign('question_id')->references('id')->on('profile_questions');
|
||||
$table->text('question')->nullable();
|
||||
$table->unsignedBigInteger('parent_sub_question_id')->nullable();
|
||||
$table->foreign('parent_sub_question_id')->references('id')->on('profile_sub_questions');
|
||||
$table->string('sub_question_type')->nullable();
|
||||
$table->string('sub_question_options')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('profile_answers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->foreign('category_id')->references('id')->on('profile_categories');
|
||||
$table->text('answer')->nullable();
|
||||
$table->unsignedBigInteger('patient_id')->nullable();
|
||||
$table->foreign('patient_id')->references('id')->on('patients');
|
||||
$table->unsignedBigInteger('question_id')->nullable();
|
||||
$table->foreign('question_id')->references('id')->on('questions');
|
||||
$table->unsignedBigInteger('sub_question_id')->nullable();
|
||||
$table->foreign('sub_question_id')->references('id')->on('profile_sub_questions');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user