mirror of
https://github.com/Karaka-Management/oms-Messages.git
synced 2026-02-15 00:38:41 +00:00
Use default database connection
This commit is contained in:
parent
9c1a5df064
commit
52d7b8cdc6
|
|
@ -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 . 'message` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'message` (
|
||||||
`message_id` int(11) NOT NULL AUTO_INCREMENT,
|
`message_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`message_type` tinyint(11) NOT NULL,
|
`message_type` tinyint(11) NOT NULL,
|
||||||
`message_account` int(11) DEFAULT NULL,
|
`message_account` int(11) DEFAULT NULL,
|
||||||
|
|
@ -57,14 +57,14 @@ class Installer extends InstallerAbstract
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'message`
|
'ALTER TABLE `' . $dbPool->get()->prefix . 'message`
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'message_ibfk_1` FOREIGN KEY (`message_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'message_ibfk_1` FOREIGN KEY (`message_account`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`),
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'message_ibfk_2` FOREIGN KEY (`message_reference`) REFERENCES `' . $dbPool->get('core')->prefix . 'message` (`message_id`);'
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'message_ibfk_2` FOREIGN KEY (`message_reference`) REFERENCES `' . $dbPool->get()->prefix . 'message` (`message_id`);'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'messages_attachment` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'messages_attachment` (
|
||||||
`messages_attachment_id` int(11) NOT NULL AUTO_INCREMENT,
|
`messages_attachment_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`messages_attachment_media` int(11) DEFAULT NULL,
|
`messages_attachment_media` int(11) DEFAULT NULL,
|
||||||
`messages_attachment_message` int(11) NULL,
|
`messages_attachment_message` int(11) NULL,
|
||||||
|
|
@ -74,10 +74,10 @@ class Installer extends InstallerAbstract
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'messages_attachment`
|
'ALTER TABLE `' . $dbPool->get()->prefix . 'messages_attachment`
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'messages_attachment_ibfk_1` FOREIGN KEY (`messages_attachment_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`),
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'messages_attachment_ibfk_1` FOREIGN KEY (`messages_attachment_media`) REFERENCES `' . $dbPool->get()->prefix . 'media` (`media_id`),
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'messages_attachment_ibfk_2` FOREIGN KEY (`messages_attachment_message`) REFERENCES `' . $dbPool->get('core')->prefix . 'message` (`message_id`);'
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'messages_attachment_ibfk_2` FOREIGN KEY (`messages_attachment_message`) REFERENCES `' . $dbPool->get()->prefix . 'message` (`message_id`);'
|
||||||
)->execute();
|
)->execute();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
'messages_attachment',
|
'messages_attachment',
|
||||||
'message'
|
'message'
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user