db->table_exists('system_account_mappings')) { throw new RuntimeException('Jalankan migration accounting foundation terlebih dahulu.'); } $exists = $this->db->where('mapping_key', 'depreciation_expense')->count_all_results('system_account_mappings') > 0; $accountExists = $this->db->where('id', 54)->count_all_results('accounts') > 0; if (!$exists && $accountExists) { $this->db->insert('system_account_mappings', array( 'mapping_key' => 'depreciation_expense', 'account_id' => 54, 'description' => 'Beban penyusutan aset', 'is_active' => 1, 'created_at' => date('Y-m-d H:i:s') )); } } public function down() { $this->db->where('mapping_key', 'depreciation_expense')->delete('system_account_mappings'); } }