A set of plugins to help on managing geographic information
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Schema\Wrapper as Wrapper;
|
||||
use App\Core\Sanity\MigratorController as Migrator;
|
||||
|
||||
function geo_zone_upgrade($pluginversion) {
|
||||
if ($pluginversion < "0.0.1") {
|
||||
$table = Wrapper::get_table("geo_zones");
|
||||
$table->addColumn("name", "string", Array("null" => false));
|
||||
$table->addColumn("city_id", "integer", Array("null" => false));
|
||||
$table->addSoftDelete();
|
||||
$table->addForeignKey('city_id', Wrapper::get_table('geo_cities'));
|
||||
$table->create();
|
||||
|
||||
Migrator::getInstance()->update_plugin_version("geo_zone", "1.0.0");
|
||||
return;
|
||||
}
|
||||
|
||||
//if ($pluginversion < "0.0.2") {
|
||||
//$table = Wrapper::get_table("geo_zones");
|
||||
//Migrator::getInstance()->update_plugin_version("geo_zone", "1.0.1");
|
||||
//return;
|
||||
//}
|
||||
}
|
||||
|
||||
function geo_zone_rollback($pluginversion) {
|
||||
if($pluginversion > "0.0.1"){
|
||||
$table = Wrapper::get_table("geo_zones");
|
||||
$table->drop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user