refactor(migrations): hapus dan perbaiki struktur tabel database

- Menghapus migration `create_currencies_table` dan `create_label_name_inspeksi_table` yang tidak digunakan.
- Menambahkan `timestamps` dan `softDeletes` pada beberapa tabel untuk peningkatan konsistensi dan fitur auditing.
- Mengubah `authorized_status` dari wajib menjadi nullable di beberapa tabel untuk fleksibilitas data.
This commit is contained in:
Daeng Deni Mardaeni
2025-05-04 20:39:59 +07:00
parent 54668820b1
commit 121d099402
16 changed files with 36 additions and 127 deletions

View File

@@ -1,40 +0,0 @@
<?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::create('currencies', function (Blueprint $table) {
$table->id();
$table->string('code', 3)->unique();
$table->string('name');
$table->integer('decimal_places')->default(2);
$table->boolean('status')->default(true)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->char('authorized_status', 1)->nullable();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down()
: void
{
Schema::dropIfExists('currencies');
}
};

View File

@@ -21,10 +21,10 @@ return new class extends Migration
$table->string('dokumen_persetujuan')->nullable();
$table->boolean('status')->nullable();
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->timestamp('deleted_at')->nullable();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();

View File

@@ -19,12 +19,12 @@ return new class extends Migration
$table->string('luas');
$table->unsignedBigInteger('jenis_jaminan_id');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -29,14 +29,12 @@ return new class extends Migration
$table->string('sifat_bangunan');
$table->string('sarana_pelengkap');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -25,14 +25,12 @@ return new class extends Migration
$table->string('bentuk_unit');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -19,15 +19,13 @@ return new class extends Migration
$table->unsignedBigInteger('analisa_tanah_bangunan_id');
$table->foreign('analisa_tanah_bangunan_id')->references('id')->on('analisa_tanah_bangunan');
$table->char('authorized_status', 1);
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->unsignedBigInteger('created_by');
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -19,15 +19,13 @@ return new class () extends Migration {
$table->unsignedBigInteger('spek_bangunan_analisa_id');
$table->foreign('spek_bangunan_analisa_id')->references('id')->on('spek_bagunan_analisa');
$table->char('authorized_status', 1);
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->unsignedBigInteger('created_by');
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -37,15 +37,13 @@ return new class () extends Migration {
$table->string('lng');
$table->text('keterangan');
$table->char('authorized_status', 1);
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->unsignedBigInteger('created_by');
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -30,15 +30,13 @@ return new class () extends Migration {
$table->string('merupakan_daerah');
$table->string('fasilitas_dekat_object');
$table->char('authorized_status', 1);
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->unsignedBigInteger('created_by');
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -20,14 +20,12 @@ return new class () extends Migration {
$table->string('luas');
$table->unsignedBigInteger('jenis_jaminan_id');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -18,14 +18,12 @@ return new class () extends Migration {
$table->string('pendamping');
$table->unsignedBigInteger('jenis_jaminan_id');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -21,14 +21,12 @@ return new class () extends Migration {
$table->unsignedBigInteger('jenis_jaminan_id');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -20,14 +20,12 @@ return new class () extends Migration {
$table->string('foto_linkungan');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -21,14 +21,12 @@ return new class () extends Migration {
$table->string('foto_rute');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps(); // created_at and updated_at
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@@ -18,13 +18,12 @@ return new class extends Migration
$table->string('foto_lantai_unit');
$table->char('authorized_status', 1)->nullable();
$table->timestamps();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->timestamp('deleted_at')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});

View File

@@ -1,28 +0,0 @@
<?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::create('label_name_inspeksi', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('label_name_inspeksi');
}
};