<?php

namespace Ministra\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\e4658d476fc6000297da2bf923569e5c6\b7e251a058376a7a61bdad14d6e3d8d38\G3e80316eff0229674f5ce5581e80e263;
use Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\e4658d476fc6000297da2bf923569e5c6\A28e1fe41bbbb5c3237b6939f8431d48a;
use Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\c12cba9723490bd14b201c8d7547a3e5\d23a6406ad44f6d815f23d432f266777;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
class Version20190902093702 extends \Doctrine\DBAL\Migrations\AbstractMigration
{
    public function up(\Doctrine\DBAL\Schema\Schema $schema)
    {
        $style = new \Symfony\Component\Console\Style\SymfonyStyle(new \Symfony\Component\Console\Input\ArrayInput([]), new \Symfony\Component\Console\Output\ConsoleOutput());
        $style->createProgressBar();
        $style->success('Start write user device info to statistics table');
        $count = \Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\e4658d476fc6000297da2bf923569e5c6\A28e1fe41bbbb5c3237b6939f8431d48a::D7da717e52c608d70fb3f48607f5636ea()->L136803cc6a5eda65dc995d2f19934c19(\Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\e4658d476fc6000297da2bf923569e5c6\b7e251a058376a7a61bdad14d6e3d8d38\G3e80316eff0229674f5ce5581e80e263::class)->createQueryBuilder()->select('count(id)')->from('users')->execute()->fetchColumn();
        $style->progressStart($count);
        \Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\e4658d476fc6000297da2bf923569e5c6\A28e1fe41bbbb5c3237b6939f8431d48a::D7da717e52c608d70fb3f48607f5636ea()->L136803cc6a5eda65dc995d2f19934c19(\Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\c12cba9723490bd14b201c8d7547a3e5\d23a6406ad44f6d815f23d432f266777::class)->run($style);
        $style->success('End write user device info to statistics table');
    }
    public function down(\Doctrine\DBAL\Schema\Schema $schema)
    {
        if ($schema->hasTable('users_devices_statistic')) {
            $query = $this->connection->getDatabasePlatform()->getTruncateTableSQL('users_devices_statistic');
            $this->addSql($query);
        }
    }
    public function getDescription()
    {
        return 'Migrate data to devices statistics table';
    }
}
