Skip to content

Commit 4baa33b

Browse files
committed
Merge pull request #3 from joegreen88/master
Some hotfixes
2 parents 306f42f + 628313a commit 4baa33b

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Smrtr/MysqlVersionControl/DbConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function getPDO($env, $buildtime = false)
3131
$config = self::getConfig($env);
3232
$config = $config[$key];
3333

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

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

5959
protected static function getProjectPath()
6060
{
61-
$parts = explode('/vendor', __FILE__);
61+
$parts = explode('vendor', __FILE__);
6262
array_pop($parts);
63-
return implode('/vendor', $parts);
63+
return trim(implode('vendor', $parts), '/\\');
6464
}
6565
}

src/Smrtr/MysqlVersionControl/UpCommand.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
7171
if ($buildConf->query("SHOW TABLES LIKE 'db_config'")->rowCount()) {
7272

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

7775
} else {
7876

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

81-
$result = $buildConf->query(
79+
$result = $buildConf->prepare(
8280
"CREATE TABLE `db_config`
8381
(
8482
`key` VARCHAR(50) COLLATE 'utf8_general_ci' NOT NULL,
@@ -88,8 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8886
PRIMARY KEY (`key`),
8987
UNIQUE INDEX `db_config_U_1` (`key`)
9088
) ENGINE=MyISAM;"
91-
)
92-
->execute();
89+
)->execute();
9390

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

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

240236
} else {

0 commit comments

Comments
 (0)