public static function init($dir, $table = null)
    {
        $templates = new TemplatesCollection();
        $templates->registerAutoTemplates();

        $config = [
            'dir'   => $dir,
            'table' => is_null($table) ? 'migrations' : $table,
        ];

        static::$migrator = new Migrator($config, $templates);

        static::addEventHandlers();

        static::turnOn();
    }