<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

/**
 * Upgrade module to version 1.0.7
 *
 * @author Igor Ratsun
 */
class resmng_upgrade_0 extends Abstract_upgrade
{

    public function up()
    {
        $ci = & get_instance();
        $check = $ci->db->select('*')->limit(1)->get('resource_type_page_data')->row_array();
        if (empty($check['updated'])) {
            $ci->db->query('ALTER TABLE `resource_type_page_data` ADD `updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ;');
            $ci->db->update('resource_type_page_data', array('updated' => date('Y-m-d H:i:s')));
        }

        return '1.0.7';
    }

    public function down()
    {
        return '0';
    }

}
