mirror of
https://github.com/Karaka-Management/oms-Auditor.git
synced 2026-02-06 09:18:40 +00:00
Move schema to json
This commit is contained in:
parent
a7b1f13e9d
commit
af6e5bb2d9
71
Admin/Install/db.json
Normal file
71
Admin/Install/db.json
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"auditor_audit": {
|
||||
"name": "auditor_audit",
|
||||
"fields": {
|
||||
"auditor_audit_id": {
|
||||
"name": "auditor_audit_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"auditor_audit_module": {
|
||||
"name": "auditor_audit_module",
|
||||
"type": "VARCHAR(255)",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"auditor_audit_ref": {
|
||||
"name": "auditor_audit_ref",
|
||||
"type": "INT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"auditor_audit_type": {
|
||||
"name": "auditor_audit_type",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"auditor_audit_subtype": {
|
||||
"name": "auditor_audit_subtype",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"auditor_audit_content": {
|
||||
"name": "auditor_audit_content",
|
||||
"type": "TEXT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"auditor_audit_old": {
|
||||
"name": "auditor_audit_old",
|
||||
"type": "TEXT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"auditor_audit_new": {
|
||||
"name": "auditor_audit_new",
|
||||
"type": "TEXT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"auditor_audit_created_at": {
|
||||
"name": "auditor_audit_created_at",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
},
|
||||
"auditor_audit_created_by": {
|
||||
"name": "auditor_audit_created_by",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"auditor_audit_ip": {
|
||||
"name": "auditor_audit_ip",
|
||||
"type": "INT",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,39 +29,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->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'auditor_audit` (
|
||||
`auditor_audit_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`auditor_audit_module` varchar(255) DEFAULT NULL,
|
||||
`auditor_audit_ref` int(11) DEFAULT NULL,
|
||||
`auditor_audit_type` smallint(3) NOT NULL,
|
||||
`auditor_audit_subtype` smallint(3) NOT NULL,
|
||||
`auditor_audit_content` text DEFAULT NULL,
|
||||
`auditor_audit_old` text DEFAULT NULL,
|
||||
`auditor_audit_new` text DEFAULT NULL,
|
||||
`auditor_audit_created_at` datetime NOT NULL,
|
||||
`auditor_audit_created_by` int(11) NOT NULL,
|
||||
`auditor_audit_ip` int(11) NOT NULL,
|
||||
PRIMARY KEY (`auditor_audit_id`),
|
||||
KEY `auditor_audit_created_by` (`auditor_audit_created_by`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get()->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get()->prefix . 'auditor_audit`
|
||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'auditor_audit_ibfk_1` FOREIGN KEY (`auditor_audit_created_by`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`);'
|
||||
)->execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user