<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddKibToTanahBangunan extends Migration
{
    public function up()
    {
        // Tambah kib dan kode_barang ke tabel tanah
        $this->forge->addColumn('tanah', [
            'kib' => [
                'type'       => 'VARCHAR',
                'constraint' => 100,
                'null'       => true,
                'after'      => 'id',
            ],
            'kode_barang' => [
                'type'       => 'VARCHAR',
                'constraint' => 100,
                'null'       => true,
                'after'      => 'kib',
            ],
        ]);

        // Tambah kib dan kode_barang ke tabel bangunan
        $this->forge->addColumn('bangunan', [
            'kib' => [
                'type'       => 'VARCHAR',
                'constraint' => 100,
                'null'       => true,
                'after'      => 'id',
            ],
            'kode_barang' => [
                'type'       => 'VARCHAR',
                'constraint' => 100,
                'null'       => true,
                'after'      => 'kib',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('tanah',    ['kib', 'kode_barang']);
        $this->forge->dropColumn('bangunan', ['kib', 'kode_barang']);
    }
}
