<?php

defined('BASEPATH') OR exit('No direct script access allowed');
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'MY_Migration.php';

class Migration_Mod_user_data_1 extends MY_Migration {

    public function up() {
        $fields = array(
            'location' => static::text(['after' => 'pax']),
            'card_name' => static::text(['after' => 'location']),
            'info_tambahan' => static::text(['after' => 'card_name']),
            'province' => static::text(['after' => 'info_tambahan']),
            'city' => static::text(['after' => 'province']),
            'district' => static::text(['after' => 'city']),
            'sub_district' => static::text(['after' => 'district']),
            'poscode' => static::text(['after' => 'sub_district']),
            'address' => static::text(['after' => 'poscode']),
            'pax_name' => static::text(['after' => 'address']),
            'pax_phone' => static::text(['after' => 'pax_name']),
            'pax_email' => static::text(['after' => 'pax_phone']),
        );
        $this->dbforge->add_column('user_data', $fields);
    }

    //--------------------------------------------------------------------

    public function down() {
        $this->dbforge->drop_column('user_data', 'location');
        $this->dbforge->drop_column('user_data', 'card_name');
        $this->dbforge->drop_column('user_data', 'info_tambahan');
        $this->dbforge->drop_column('user_data', 'province');
        $this->dbforge->drop_column('user_data', 'city');
        $this->dbforge->drop_column('user_data', 'district');
        $this->dbforge->drop_column('user_data', 'sub_district');
        $this->dbforge->drop_column('user_data', 'poscode');
        $this->dbforge->drop_column('user_data', 'address');
        $this->dbforge->drop_column('user_data', 'pax_name');
        $this->dbforge->drop_column('user_data', 'pax_phone');
        $this->dbforge->drop_column('user_data', 'pax_email');
    }

}
