fix: migration & seed

This commit is contained in:
Nawcodes 2025-04-26 15:22:58 +07:00
parent eb6fe9b6a2
commit 0c945e164b
11 changed files with 20 additions and 9 deletions

View File

@ -15,6 +15,10 @@ return new class extends Migration
Schema::create('ms_pasien', function (Blueprint $table) {
$table->id('mr_pasien');
$table->string('nama');
$table->string('nik')->unique();
$table->string('no_hp');
$table->string('alamat');
$table->string('email');
$table->date('tgl_lahir');
$table->enum('jenis_kelamin', ['L', 'P']);
$table->timestamps();

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('ms_asuransi', function (Blueprint $table) {
$table->id('id_asuransi');
$table->string('id_asuransi')->primary();
$table->string('nama_asuransi');
$table->timestamps();
});

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('ms_pegawai', function (Blueprint $table) {
$table->id('id_pegawai');
$table->string('id_pegawai')->primary();
$table->string('nama_pegawai');
$table->timestamps();
});

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('ms_ruang_pelayanan', function (Blueprint $table) {
$table->id('id_ruang_pelayanan');
$table->string('id_ruang_pelayanan')->primary();
$table->string('nama_ruang_pelayanan');
$table->timestamps();
});

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('ms_tindakan', function (Blueprint $table) {
$table->id('id_tindakan');
$table->string('id_tindakan')->primary();
$table->string('nama_tindakan');
$table->decimal('tarif_tindakan', 12, 2);
$table->timestamps();

View File

@ -15,9 +15,9 @@ return new class extends Migration
$table->id('id_registrasi');
$table->date('tgl_registrasi');
$table->unsignedBigInteger('mr_pasien');
$table->unsignedBigInteger('id_asuransi')->nullable();
$table->unsignedBigInteger('id_pegawai');
$table->unsignedBigInteger('id_ruang_pelayanan');
$table->string('id_asuransi')->nullable();
$table->string('id_pegawai');
$table->string('id_ruang_pelayanan');
$table->string('nomor_kartu_asuransi')->nullable();
$table->timestamps();

View File

@ -14,8 +14,8 @@ return new class extends Migration
Schema::create('tr_transaksi', function (Blueprint $table) {
$table->id('id_transaksi');
$table->unsignedBigInteger('id_registrasi');
$table->unsignedBigInteger('id_tindakan');
$table->unsignedBigInteger('id_pegawai');
$table->string('id_tindakan');
$table->string('id_pegawai');
$table->integer('jml_tindakan')->default(1);
$table->timestamps();

View File

@ -18,6 +18,10 @@ class PasienSeeder extends Seeder
foreach (range(1, 10) as $i) {
DB::table('ms_pasien')->insert([
'nama' => $faker->name,
'nik' => $faker->unique()->randomNumber(8),
'no_hp' => $faker->phoneNumber,
'alamat' => $faker->address,
'email' => $faker->email,
'tgl_lahir' => $faker->date('Y-m-d', '-18 years'), // minimal 18 tahun
'jenis_kelamin' => $faker->randomElement(['L', 'P']),
'created_at' => now(),

View File

@ -17,6 +17,7 @@ class PegawaiSeeder extends Seeder
foreach (range(1, 10) as $i) {
DB::table('ms_pegawai')->insert([
'id_pegawai' => 'PGW-' . $faker->unique()->randomNumber(8),
'nama_pegawai' => $faker->name,
'created_at' => now(),
'updated_at' => now(),

View File

@ -17,6 +17,7 @@ class RuangPelayananSeeder extends Seeder
foreach (range(1, 10) as $i) {
DB::table('ms_ruang_pelayanan')->insert([
'id_ruang_pelayanan' => 'RPL-' . $faker->unique()->randomNumber(8),
'nama_ruang_pelayanan' => 'Ruang ' . $faker->word,
'created_at' => now(),
'updated_at' => now(),

View File

@ -17,6 +17,7 @@ class TindakanSeeder extends Seeder
foreach (range(1, 10) as $i) {
DB::table('ms_tindakan')->insert([
'id_tindakan' => 'TIN-' . $faker->unique()->randomNumber(8),
'nama_tindakan' => 'Tindakan ' . $faker->word,
'tarif_tindakan' => $faker->randomFloat(2, 50000, 500000),
'created_at' => now(),