<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_create_promotional_sms_log_table extends CI_Migration {

    public function up()
    {
        $this->dbforge->add_field(array(
            'id' => array(
                'type' => 'INT',
                'constraint' => 11,
                'unsigned' => TRUE,
                'auto_increment' => TRUE
            ),
            'store_id' => array(
                'type' => 'INT',
                'constraint' => 11,
                'null' => TRUE
            ),
            'send_type' => array(
                'type' => 'VARCHAR',
                'constraint' => 50,
                'null' => TRUE
            ),
            'message' => array(
                'type' => 'TEXT',
                'null' => TRUE
            ),
            'success_count' => array(
                'type' => 'INT',
                'constraint' => 11,
                'default' => 0
            ),
            'failed_count' => array(
                'type' => 'INT',
                'constraint' => 11,
                'default' => 0
            ),
            'failed_recipients' => array(
                'type' => 'TEXT',
                'null' => TRUE
            ),
            'created_date' => array(
                'type' => 'DATE',
                'null' => TRUE
            ),
            'created_time' => array(
                'type' => 'VARCHAR',
                'constraint' => 30,
                'null' => TRUE
            ),
            'created_by' => array(
                'type' => 'VARCHAR',
                'constraint' => 50,
                'null' => TRUE
            )
        ));
        
        $this->dbforge->add_key('id', TRUE);
        $this->dbforge->create_table('db_promotional_sms_log');
    }

    public function down()
    {
        $this->dbforge->drop_table('db_promotional_sms_log');
    }
}
