Update besar apk finance
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class Migration_Complete_purchase_tracking_settlement extends CI_Migration
|
||||
{
|
||||
public function up(){
|
||||
foreach(array('purchase_request_lines','purchase_order_lines')as$t){if(!$this->db->field_exists('tracking_type',$t))$this->db->query("ALTER TABLE `$t` ADD tracking_type ENUM('UNIT','QTY') NULL");if(!$this->db->field_exists('qty_per_barcode',$t))$this->db->query("ALTER TABLE `$t` ADD qty_per_barcode DECIMAL(18,4) NULL");if(!$this->db->field_exists('need_serial_number',$t))$this->db->query("ALTER TABLE `$t` ADD need_serial_number TINYINT(1) NOT NULL DEFAULT 0");}
|
||||
if(!$this->db->field_exists('payment_plan','supplier_invoices'))$this->db->query("ALTER TABLE supplier_invoices ADD payment_plan ENUM('cash','installment','credit') NOT NULL DEFAULT 'credit' AFTER due_date");
|
||||
if(!$this->db->field_exists('source_receipt_line_id','item_barcodes'))$this->db->query('ALTER TABLE item_barcodes ADD source_receipt_line_id BIGINT UNSIGNED NULL');
|
||||
if(!$this->db->field_exists('barcode_id','purchase_return_lines'))$this->db->query('ALTER TABLE purchase_return_lines ADD barcode_id INT NULL AFTER item_id');
|
||||
$this->db->query("UPDATE purchase_request_lines l JOIN kode_barang k ON k.id=l.kode_barang_id SET l.tracking_type=k.tracking_type,l.need_serial_number=IF(k.need_serial_number='true',1,0),l.qty_per_barcode=IF(k.tracking_type='UNIT',1,NULL) WHERE l.tracking_type IS NULL");
|
||||
$this->db->query("UPDATE purchase_order_lines l JOIN kode_barang k ON k.id=l.kode_barang_id SET l.tracking_type=k.tracking_type,l.need_serial_number=IF(k.need_serial_number='true',1,0),l.qty_per_barcode=IF(k.tracking_type='UNIT',1,NULL) WHERE l.tracking_type IS NULL");
|
||||
}
|
||||
public function down(){throw new RuntimeException('Gunakan backup untuk rollback workflow tracking pembelian.');}
|
||||
}
|
||||
Reference in New Issue
Block a user