A set of plugins to help on managing geographic information

This commit is contained in:
ahwelp
2023-01-24 20:41:37 +00:00
parent 616a97f16c
commit a60cfcec3a
61 changed files with 7895 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
use Schema\Wrapper as Wrapper;
use App\Core\Sanity\MigratorController as Migrator;
function geo_country_upgrade($pluginversion) {
if ($pluginversion < "0.0.1") {
$table = Wrapper::get_table("geo_countries");
$table->addSoftDelete();
$table->addColumn("name", "string", Array("null" => false));
$table->addColumn("description", "string", Array("null" => true));
$table->addColumn("code", "integer", Array("null" => false));
$table->addColumn("iso2", "string", Array("null" => false, 'limit' => 2));
$table->addColumn("iso3", "string", Array("null" => false, 'limit' => 3));
$table->save();
Wrapper::exec(file_get_contents(__DIR__.'/001_countries_seeding.sql') );
Migrator::getInstance()->update_plugin_version("geo_country", "1.0.0");
return;
}
//if ($pluginversion < "0.0.2") {
//$table = Wrapper::get_table("geo_country");
//Migrator::getInstance()->update_plugin_version("geo_country", "1.0.1");
//return;
//}
}
function geo_country_rollback($pluginversion) {
if($pluginversion > "0.0.1"){
$table = Wrapper::get_table("geo_countries");
$table->drop();
return;
}
}