DNSBlock
This commit is contained in:
30
database/migration_create_api_logs.php
Normal file
30
database/migration_create_api_logs.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use App\Config\Database;
|
||||
|
||||
try {
|
||||
$conn = Database::getInstance()->getConnection();
|
||||
|
||||
echo "Criando tabela api_logs...\n";
|
||||
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `api_logs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` int(11) DEFAULT NULL,
|
||||
`action` varchar(50) NOT NULL,
|
||||
`message` text,
|
||||
`ip_address` varchar(45) DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `server_id` (`server_id`),
|
||||
CONSTRAINT `fk_apilogs_server` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;";
|
||||
|
||||
$conn->exec($sql);
|
||||
echo "Tabela api_logs criada com sucesso.\n";
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Erro: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user