<?php

use Schema\Wrapper as Wrapper;
use App\Core\Sanity\MigratorController as Migrator;

function geo_params_upgrade($pluginversion) {
    if ($pluginversion < "0.0.1") {
        $table = Wrapper::get_table("geo_params");
        $table->addColumn("table", "string", Array("null" => false));
        $table->addColumn("key",   "string", Array("null" => false));
        $table->addColumn("value", "string", Array("null" => false));
        $table->create();

        Migrator::getInstance()->update_plugin_version("geo_params", "1.0.0");
        return;
    }    
}

function geo_params_rollback($pluginversion) {
    if($pluginversion > "0.0.1"){
        $table = Wrapper::get_table("geo_params");
        $table->drop();
        return;
    }
}