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, `updated` datetime DEFAULT NULL,
`draft` tinyint(1) NOT NULL DEFAULT 1, `draft` tinyint(1) NOT NULL DEFAULT 1,
`changefreq` varchar(7) NOT NULL DEFAULT 'monthly', `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,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
EOSQL; EOSQL;
$db->query($query); $db->query($query);
$log->info('Pages Table Created'); $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 // Check if a user exists

View File

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

View File

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