Use default database connection

This commit is contained in:
Dennis Eichhorn 2017-09-23 13:58:09 +02:00
parent 4afc944e3a
commit a2ab468e53
2 changed files with 15 additions and 15 deletions

View File

@ -38,10 +38,10 @@ class Installer extends InstallerAbstract
{ {
parent::install(__DIR__ . '/..', $dbPool, $info); parent::install(__DIR__ . '/..', $dbPool, $info);
switch ($dbPool->get('core')->getType()) { switch ($dbPool->get()->getType()) {
case DatabaseType::MYSQL: case DatabaseType::MYSQL:
$dbPool->get('core')->con->prepare( $dbPool->get()->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'news` (
`news_id` int(11) NOT NULL AUTO_INCREMENT, `news_id` int(11) NOT NULL AUTO_INCREMENT,
`news_title` varchar(250) NOT NULL, `news_title` varchar(250) NOT NULL,
`news_featured` tinyint(1) DEFAULT NULL, `news_featured` tinyint(1) DEFAULT NULL,
@ -58,21 +58,21 @@ class Installer extends InstallerAbstract
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute(); )->execute();
$dbPool->get('core')->con->prepare( $dbPool->get()->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'news` 'ALTER TABLE `' . $dbPool->get()->prefix . 'news`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_ibfk_1` FOREIGN KEY (`news_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' ADD CONSTRAINT `' . $dbPool->get()->prefix . 'news_ibfk_1` FOREIGN KEY (`news_created_by`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`);'
)->execute(); )->execute();
$dbPool->get('core')->con->prepare( $dbPool->get()->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news_badge` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'news_badge` (
`news_badge_id` int(11) NOT NULL AUTO_INCREMENT, `news_badge_id` int(11) NOT NULL AUTO_INCREMENT,
`news_badge_title` varchar(20) NOT NULL, `news_badge_title` varchar(20) NOT NULL,
PRIMARY KEY (`news_badge_id`) PRIMARY KEY (`news_badge_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute(); )->execute();
$dbPool->get('core')->con->prepare( $dbPool->get()->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news_badge_relation` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'news_badge_relation` (
`news_badge_relation_id` int(11) NOT NULL AUTO_INCREMENT, `news_badge_relation_id` int(11) NOT NULL AUTO_INCREMENT,
`news_badge_relation_news` int(11) NOT NULL, `news_badge_relation_news` int(11) NOT NULL,
`news_badge_relation_badge` int(11) NOT NULL, `news_badge_relation_badge` int(11) NOT NULL,
@ -82,10 +82,10 @@ class Installer extends InstallerAbstract
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute(); )->execute();
$dbPool->get('core')->con->prepare( $dbPool->get()->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'news_badge_relation` 'ALTER TABLE `' . $dbPool->get()->prefix . 'news_badge_relation`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_badge_relation_ibfk_1` FOREIGN KEY (`news_badge_relation_news`) REFERENCES `' . $dbPool->get('core')->prefix . 'news` (`news_id`), ADD CONSTRAINT `' . $dbPool->get()->prefix . 'news_badge_relation_ibfk_1` FOREIGN KEY (`news_badge_relation_news`) REFERENCES `' . $dbPool->get()->prefix . 'news` (`news_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_badge_relation_ibfk_2` FOREIGN KEY (`news_badge_relation_badge`) REFERENCES `' . $dbPool->get('core')->prefix . 'news_badge` (`news_badge_id`);' ADD CONSTRAINT `' . $dbPool->get()->prefix . 'news_badge_relation_ibfk_2` FOREIGN KEY (`news_badge_relation_badge`) REFERENCES `' . $dbPool->get()->prefix . 'news_badge` (`news_badge_id`);'
)->execute(); )->execute();
break; break;
} }

View File

@ -39,7 +39,7 @@ class Uninstall extends UninstallAbstract
$query = new Builder($dbPool->get()); $query = new Builder($dbPool->get());
$query->prefix($dbPool->get('core')->getPrefix())->drop( $query->prefix($dbPool->get()->getPrefix())->drop(
'news_group', 'news_group',
'news_tag', 'news_tag',
'news' 'news'