Пример #1
0
<?php

namespace WakaBot;

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/env/conf.php';
$log = new \Yaoi\Log('colored-stdout');
\WakaBot\Duration::table()->migration()->setLog($log)->apply();
\WakaBot\DayStat::table()->migration()->setLog($log)->apply();
\WakaBot\WakaUser::table()->migration()->setLog($log)->apply();
Пример #2
0
    return $settings;
});
Http\Client::register(function () {
    $client = new Http\Client();
    $client->mock(new Mock(Storage::getInstance('mock')));
    return $client;
});
Storage::register(function () {
    $settings = new Storage\Settings();
    $settings->driverClassName = Storage\Driver\SerializedFile::className();
    $settings->path = __DIR__ . '/resources/mock4.serialized';
    return $settings;
}, 'mock');
Database::register('mysqli://root:@localhost/wakabot?timezone=Asia/Jakarta');
/*
Database::register(function(){
    $settings = new Database\Settings();
    $settings->driverClassName = Database\Driver\Sqlite::className();
    $settings->path = __DIR__ . '/resources/db.sqlite';
    return $settings;
}, 'sqlite');
*/
Migration\Manager::register(function () {
    $settings = new Migration\Settings();
    $settings->storage = new Storage('serialized-file:///' . __DIR__ . '/resources/migration.serialized');
    $settings->run = function () {
    };
    return $settings;
});
Migration\Manager::getInstance()->perform(DayStat::getCreateTableMigration())->perform(Duration::getCreateTableMigration());