Skip to content

Commit 4fef64c

Browse files
author
Alexandre Guidet
committed
Merge branch 'hotfix-3.6.10'
2 parents 7dc6fd3 + cbe99bb commit 4fef64c

5 files changed

Lines changed: 10 additions & 2 deletions

File tree

Migrate/Command/AbstractEnvCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ protected function init(InputInterface $input, OutputInterface $output, $env = n
8080
$dbname = ArrayUtil::get($conf['connection'], 'database');
8181
$username = ArrayUtil::get($conf['connection'], 'username');
8282
$password = ArrayUtil::get($conf['connection'], 'password');
83+
$charset = ArrayUtil::get($conf['connection'], 'charset');
8384

8485
$uri = $driver;
8586

@@ -89,6 +90,7 @@ protected function init(InputInterface $input, OutputInterface $output, $env = n
8990
$uri .= ($dbname === null) ? '' : ":dbname=$dbname";
9091
$uri .= ($host === null) ? '' : ";host=$host";
9192
$uri .= ($port === null) ? '' : ";port=$port";
93+
$uri .= ($charset === null) ? '' : ";charset=$charset";
9294
}
9395
$this->db = new \PDO(
9496
$uri,

Migrate/Command/AddEnvCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969
$dbUserPasswordQuestion = new Question("Please enter the database user password (if needed): ", "~");
7070
$dbUserPassword = $questions->ask($input, $output, $dbUserPasswordQuestion);
7171

72+
$dbCharsetQuestion = new Question("Please enter the database charset (if needed): ", "~");
73+
$dbCharset = $questions->ask($input, $output, $dbCharsetQuestion);
74+
7275
$changelogTableQuestion = new Question("Please enter the changelog table <info>(default changelog)</info>: ", "changelog");
7376
$changelogTable = $questions->ask($input, $output, $changelogTableQuestion);
7477

@@ -82,6 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8285
$confTemplate = str_replace('{USERNAME}', $dbUserName, $confTemplate);
8386
$confTemplate = str_replace('{PASSWORD}', $dbUserPassword, $confTemplate);
8487
$confTemplate = str_replace('{DATABASE}', $dbName, $confTemplate);
88+
$confTemplate = str_replace('{CHARSET}', $dbCharset, $confTemplate);
8589
$confTemplate = str_replace('{CHANGELOG}', $changelogTable, $confTemplate);
8690
$confTemplate = str_replace('{EDITOR}', $defaultEditor, $confTemplate);
8791

templates/env.yml.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ connection:
55
username: {USERNAME}
66
password: {PASSWORD}
77
database: {DATABASE}
8+
charset: {CHARSET}
89

910
changelog: {CHANGELOG}
1011
default_editor: {EDITOR}

tests/Command/AbstractCommandTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function createEnv()
4747

4848
/* @var $question QuestionHelper */
4949
$question = $command->getHelper('question');
50-
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\ntest.sqlite\n\n\n\n\nchangelog\nvim\n"));
50+
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\ntest.sqlite\n\n\n\n\n\nchangelog\nvim\n"));
5151

5252
$commandTester->execute(array('command' => $command->getName()));
5353
}

tests/Command/AddenvCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testExecute()
4444

4545
/* @var $question QuestionHelper */
4646
$question = $command->getHelper('question');
47-
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\nmigrate_test\nlocalhost\n5432\naguidet\naguidet\nchangelog\nvim\n"));
47+
$question->setInputStream(InputStreamUtil::type("testing\n$driverKey\nmigrate_test\nlocalhost\n5432\naguidet\naguidet\nutf8\nchangelog\nvim\n"));
4848

4949
$commandTester->execute(array('command' => $command->getName()));
5050

@@ -62,6 +62,7 @@ public function testExecute()
6262
username: aguidet
6363
password: aguidet
6464
database: migrate_test
65+
charset: utf8
6566
6667
changelog: changelog
6768
default_editor: vim

0 commit comments

Comments
 (0)