fixed bugs for setup, added messages table

This commit is contained in:
Nick Yeoman 2025-10-08 23:34:17 -07:00
parent 344786ee95
commit fb5407a60b
3 changed files with 33 additions and 3 deletions

View File

@ -103,13 +103,39 @@ if ($result->num_rows === 0) {
`updated` datetime DEFAULT NULL,
`draft` tinyint(1) NOT NULL DEFAULT 1,
`changefreq` varchar(7) NOT NULL DEFAULT 'monthly',
`priority` float(4,1) NOT NULL DEFAULT 0.0
`priority` float(4,1) NOT NULL DEFAULT 0.0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
EOSQL;
$db->query($query);
$log->info('Pages Table Created');
}
// Check ContactForm Table
$query = <<<EOSQL
SELECT TABLE_NAME
FROM information_schema.tables
WHERE table_schema = DATABASE()
AND TABLE_NAME = 'contactForm';
EOSQL;
$result = $db->query($query);
if ($result->num_rows === 0) {
$query = <<<EOSQL
CREATE TABLE `contactForm` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`message` text DEFAULT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`unread` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Unread is true by default',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
EOSQL;
$db->query($query);
$log->info('ContactForm Table Created');
}
// Check if a user exists

View File

@ -20,7 +20,6 @@ services:
mariadb:
image: mariadb:latest
container_name: mariadb
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: novadb

View File

@ -42,6 +42,11 @@ class Logger {
$this->log('WARNING', $msg);
}
// Alias
public function warn(string $msg): void {
$this->log('WARNING', $msg);
}
public function error(string $msg): void {
$this->log('ERROR', $msg);
}