39 lines
893 B
PHP
39 lines
893 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()
|
|
{
|
|
Schema::create('pasiens', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('id_user'); // Kolom id_user
|
|
$table->string('name');
|
|
$table->integer('age');
|
|
$table->string('phone');
|
|
$table->string('alamat');
|
|
$table->timestamps();
|
|
|
|
// Foreign key constraint
|
|
$table->foreign('id_user')->references('id')->on('users')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('pasiens');
|
|
}
|
|
};
|