This commit is contained in:
Dwi Swandhana
2026-02-21 06:06:56 +07:00
parent 5274d53681
commit 3c63cb5d22
6 changed files with 923 additions and 556 deletions
@@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('simbhpjenis', function (Blueprint $table) {
if (!Schema::hasColumn('simbhpjenis', 'satuan_kecil')) {
$table->string('satuan_kecil', 100)->nullable()->after('satuan');
}
if (!Schema::hasColumn('simbhpjenis', 'konversi_kecil')) {
$table->integer('konversi_kecil')->default(1)->after('satuan_kecil');
}
if (!Schema::hasColumn('simbhpjenis', 'stok_minimum')) {
$table->integer('stok_minimum')->default(0)->after('konversi_kecil');
}
});
Schema::table('simbhpreport', function (Blueprint $table) {
if (!Schema::hasColumn('simbhpreport', 'qty_base')) {
$table->integer('qty_base')->nullable()->after('pengeluaran');
}
if (!Schema::hasColumn('simbhpreport', 'satuan_transaksi')) {
$table->string('satuan_transaksi', 20)->nullable()->after('qty_base');
}
});
}
public function down(): void
{
Schema::table('simbhpreport', function (Blueprint $table) {
if (Schema::hasColumn('simbhpreport', 'qty_base')) {
$table->dropColumn('qty_base');
}
if (Schema::hasColumn('simbhpreport', 'satuan_transaksi')) {
$table->dropColumn('satuan_transaksi');
}
});
Schema::table('simbhpjenis', function (Blueprint $table) {
if (Schema::hasColumn('simbhpjenis', 'satuan_kecil')) {
$table->dropColumn('satuan_kecil');
}
if (Schema::hasColumn('simbhpjenis', 'konversi_kecil')) {
$table->dropColumn('konversi_kecil');
}
if (Schema::hasColumn('simbhpjenis', 'stok_minimum')) {
$table->dropColumn('stok_minimum');
}
});
}
};