blessing-skin-server/app/Core/Database/Migration.php
2016-08-25 22:44:03 +08:00

31 lines
665 B
PHP

<?php
namespace Blessing\Database;
use Blessing\Storage;
class Migration
{
/**
* Create tables, prefix will be added automatically
*
* @return void
*/
public static function creatTables()
{
require BASE_DIR."/setup/tables.php";
}
public static function __callStatic($method, $args)
{
if (strpos($method, 'import') !== false) {
$filename = BASE_DIR."/setup/migrations/".snake_case($method).".php";
if (Storage::exists($filename)) {
return require $filename;
}
}
throw new \InvalidArgumentException('Non-existent migration');
}
}