<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddHargaToBarangTable extends Migration
{
    public function up()
    {
        $this->forge->addColumn('barang', [
            'harga_beli' => [
                'type'       => 'DECIMAL',
                'constraint' => '15,2',
                'default'    => 0,
                'after'      => 'lokasi_barang',
            ],
            'harga_jual' => [
                'type'       => 'DECIMAL',
                'constraint' => '15,2',
                'default'    => 0,
                'after'      => 'harga_beli',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('barang', ['harga_beli', 'harga_jual']);
    }
}
