From d4eedecb535134ed8493cf6ba9e16f13bb643f61 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 23 Dec 2018 15:18:00 +0100 Subject: [PATCH] Move schema to json --- Admin/Install/db.json | 60 +++++++++++++++++++++++++++++++++++++++++++ Admin/Installer.php | 35 ------------------------- 2 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 Admin/Install/db.json diff --git a/Admin/Install/db.json b/Admin/Install/db.json new file mode 100644 index 0000000..a369bcc --- /dev/null +++ b/Admin/Install/db.json @@ -0,0 +1,60 @@ +{ + "monitoring_file": { + "name": "monitoring_file", + "fields": { + "monitoring_file_id": { + "name": "monitoring_file_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "monitoring_file_path": { + "name": "monitoring_file_path", + "type": "VARCHAR(255)", + "default": null, + "null": true + }, + "monitoring_file_modified": { + "name": "monitoring_file_modified", + "type": "DATETIME", + "null": false + }, + "monitoring_file_deprecated": { + "name": "monitoring_file_deprecated", + "type": "TINYINT", + "null": false + }, + "monitoring_file_dangerous": { + "name": "monitoring_file_dangerous", + "type": "TINYINT", + "null": false + }, + "monitoring_file_unicode": { + "name": "monitoring_file_unicode", + "type": "TINYINT", + "null": false + }, + "monitoring_file_version": { + "name": "monitoring_file_version", + "type": "TINYINT", + "null": false + }, + "monitoring_file_hash": { + "name": "monitoring_file_hash", + "type": "TINYINT", + "null": false + }, + "monitoring_file_status": { + "name": "monitoring_file_status", + "type": "TINYINT", + "null": false + }, + "monitoring_file_inspected": { + "name": "monitoring_file_inspected", + "type": "DATETIME", + "null": false + } + } + } +} \ No newline at end of file diff --git a/Admin/Installer.php b/Admin/Installer.php index 7a88824..f8cb3e4 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -14,9 +14,6 @@ declare(strict_types=1); namespace Modules\Monitoring\Admin; -use phpOMS\DataStorage\Database\DatabasePool; -use phpOMS\DataStorage\Database\DatabaseType; -use phpOMS\Module\InfoManager; use phpOMS\Module\InstallerAbstract; /** @@ -29,36 +26,4 @@ use phpOMS\Module\InstallerAbstract; */ class Installer extends InstallerAbstract { - - /** - * {@inheritdoc} - */ - public static function install(DatabasePool $dbPool, InfoManager $info) : void - { - parent::install($dbPool, $info); - - switch ($dbPool->get()->getType()) { - case DatabaseType::MYSQL: - $dbPool->get()->con->beginTransaction(); - - $dbPool->get()->con->prepare( - 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'monitoring_file` ( - `monitoring_file_id` int(11) NOT NULL AUTO_INCREMENT, - `monitoring_file_path` text DEFAULT NULL, - `monitoring_file_modified` datetime NOT NULL, - `monitoring_file_deprecated` tinyint(1) NOT NULL, - `monitoring_file_dangerous` tinyint(1) NOT NULL, - `monitoring_file_unicode` tinyint(1) NOT NULL, - `monitoring_file_version` tinyint(1) NOT NULL, - `monitoring_file_hash` tinyint(1) NOT NULL, - `monitoring_file_status` tinyint(1) NOT NULL, - `monitoring_file_inspected` datetime NOT NULL, - PRIMARY KEY (`monitoring_file_id`) - )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' - )->execute(); - - $dbPool->get()->con->commit(); - break; - } - } }