Skip to content

Commit

Permalink
Merge pull request #3 from joegreen88/master
Browse files Browse the repository at this point in the history
Some hotfixes
  • Loading branch information
joegreen88 committed Feb 12, 2014
2 parents 306f42f + 628313a commit 4baa33b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Smrtr/MysqlVersionControl/DbConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function getPDO($env, $buildtime = false)
$config = self::getConfig($env);
$config = $config[$key];

$dsn = sprintf('mysql:host=%s;dbname=%s', $config['host'], $config['dbname']);
$dsn = sprintf('mysql:host=%s;dbname=%s', $config['host'], $config['database']);
$db = new \PDO($dsn, $config['user'], $config['password']);

return $db;
Expand All @@ -58,8 +58,8 @@ protected static function getConfigFile()

protected static function getProjectPath()
{
$parts = explode('/vendor', __FILE__);
$parts = explode('vendor', __FILE__);
array_pop($parts);
return implode('/vendor', $parts);
return trim(implode('vendor', $parts), '/\\');
}
}
8 changes: 2 additions & 6 deletions src/Smrtr/MysqlVersionControl/UpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($buildConf->query("SHOW TABLES LIKE 'db_config'")->rowCount()) {

$output->writeln('<info>Database version control is already installed.</info>');
self::$checkList['db-schema'] = true;
return true;

} else {

$output->writeln('Installing version control...');

$result = $buildConf->query(
$result = $buildConf->prepare(
"CREATE TABLE `db_config`
(
`key` VARCHAR(50) COLLATE 'utf8_general_ci' NOT NULL,
Expand All @@ -88,8 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
PRIMARY KEY (`key`),
UNIQUE INDEX `db_config_U_1` (`key`)
) ENGINE=MyISAM;"
)
->execute();
)->execute();

if (!$result) {
$output->writeln('<error>Installing version control failed.</error>');
Expand Down Expand Up @@ -234,7 +231,6 @@ protected function execute(InputInterface $input, OutputInterface $output)

if ($result) {
$output->writeln('<info>Database updates installed successfully.</info>');
self::$checkList['db-update'] = true;
return true;

} else {
Expand Down

0 comments on commit 4baa33b

Please sign in to comment.