src/PHPDish/Bundle/CoreBundle/Command/InstallDatabaseCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $outputStyle = new SymfonyStyle($input, $output);
        $outputStyle->writeln('Creating PHPDish database.');

        //如果数据表存在，则询问是否重置
        if ($this->isDatabasePresent() && $this->isSchemaPresent()) {
            $outputStyle->writeln('It appears that your database already exists.');
            $outputStyle->writeln('<error>Warning! This action will erase your database.</error>');
            $questionHelper = $this->getHelper('question');
            $question = new ConfirmationQuestion('Would you like to reset it? (y/N) ', false);

            if ($questionHelper->ask($input, $output, $question)) {
                $this->commands[2] = [
                    'command' => 'doctrine:schema:drop',
                    'options' => [
                        '--force' => true,
                        '--full-database' => true,
                    ],
                ];
            }
        }

        //执行创建命令
        $this->createSchemaWithProgressbar($output);
        $outputStyle->newLine();
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $outputStyle = new SymfonyStyle($input, $output);
        $outputStyle->writeln('Creating PHPDish database.');

        //如果数据表存在，则询问是否重置
        if ($this->isDatabasePresent() && $this->isSchemaPresent()) {
            $outputStyle->writeln('It appears that your database already exists.');
            $outputStyle->writeln('<error>Warning! This action will erase your database.</error>');
            $questionHelper = $this->getHelper('question');
            $question = new ConfirmationQuestion('Would you like to reset it? (y/N) ', false);

            if ($questionHelper->ask($input, $output, $question)) {
                $this->commands[2] = [
                    'command' => 'doctrine:schema:drop',
                    'options' => [
                        '--force' => true,
                        '--full-database' => true,
                    ],
                ];
            }
        }

        //执行创建命令
        $this->createSchemaWithProgressbar($output);
        $outputStyle->newLine();
    }
{@inheritdoc}