migration appointment & seeder

This commit is contained in:
Muhammad Fajar
2022-11-04 09:54:08 +07:00
parent 975f6cec35
commit 4b4104bc6b
5 changed files with 181 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointment_types', function (Blueprint $table) {
$table->id();
$table->string('code');
$table->string('name');
$table->string('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('appointment_types');
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointments', function (Blueprint $table) {
$table->id();
$table->string('status');
$table->string('cancelation_reason');
$table->string('appointment_type');
$table->string('description');
$table->string('duration_minutes');
$table->string('start_time');
$table->string('end_time');
$table->text('comment');
$table->text('patient_instruction');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('appointments');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointment_participants', function (Blueprint $table) {
$table->id();
$table->string('type');
$table->string('participantable_type');
$table->string('participantable_id');
$table->string('status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('appointment_participants');
}
};

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('appointments', function (Blueprint $table) {
$table->foreignId('speciality_id')->nullable()->after('appointment_type');
$table->foreignId('organization_id')->nullable()->after('end_time');
});
Schema::table('appointment_participants', function (Blueprint $table) {
$table->foreignId('appointment_id')->nullable()->after('id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('appointments', function (Blueprint $table) {
$table->dropColumn('speciality_id');
$table->dropColumn('organization_id');
});
Schema::table('appointment_participants', function (Blueprint $table) {
$table->dropColumn('appointment_id');
});
}
};