Common functionalities
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Schema\Wrapper as Wrapper;
|
||||
use App\Core\Sanity\MigratorController as Migrator;
|
||||
|
||||
function common_defaults_upgrade($pluginversion) {
|
||||
if ($pluginversion < "0.0.1") {
|
||||
$table = Wrapper::get_table("common_system_defaults");
|
||||
$table->addColumn("module", "string", Array("null" => true));
|
||||
$table->addColumn("table", "string", Array("null" => true));
|
||||
$table->addColumn("key", "string", Array("null" => false));
|
||||
$table->addColumn("value", "string", Array("null" => false));
|
||||
$table->create();
|
||||
|
||||
$table = Wrapper::get_table("common_user_defaults");
|
||||
$table->addColumn("user_id", "integer", Array("null" => false));
|
||||
$table->addColumn("module", "string", Array("null" => true));
|
||||
$table->addColumn("table", "string", Array("null" => true));
|
||||
$table->addColumn("key", "string", Array("null" => false));
|
||||
$table->addColumn("value", "string", Array("null" => false));
|
||||
$table->addForeignKey('user_id', Wrapper::get_table('core_auth_user'));
|
||||
|
||||
Migrator::getInstance()->update_plugin_version("common_defaults", "1.0.0");
|
||||
return;
|
||||
}
|
||||
|
||||
//if ($pluginversion < "0.0.2") {
|
||||
//$table = Wrapper::get_table("common_defaultss");
|
||||
//Migrator::getInstance()->update_plugin_version("common_defaults", "1.0.1");
|
||||
//return;
|
||||
//}
|
||||
}
|
||||
|
||||
function common_defaults_rollback($pluginversion) {
|
||||
if($pluginversion > "0.0.1"){
|
||||
$table = Wrapper::get_table("common_defaultss");
|
||||
$table->drop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user