<?php

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

/**
 * Upgrade Inlineeditor module to version 3.3.0
 *
 * @author CIEXT skeleton
 */
class Inlineeditor_upgrade_0 extends \Ciext\Migration\AbstractUpgrade
{

    public function up()
    {
        if (!$this->is_table_exist('inlineeditor_text')) {
            $ci = &get_instance();
            foreach (explode(';', file_get_contents(dirname($ci->config->item('composer_autoload')) . '/ciext/inlineeditor/data/upgrade_0.sql')) as $q) {
                $q = trim($q);
                if (!empty($q)) {
                    $ci->db->query($q);
                }
            }
        }

        return '3.3.0';
    }

    public function down()
    {
        if ($this->is_table_exist('inlineeditor_text')) {
            $ci = &get_instance();
            $ci->db->query('DROP TABLE `inlineeditor_text`');
        }

        return '0';
    }

}
