fixed bugs for setup, added messages table
This commit is contained in:
		
							parent
							
								
									344786ee95
								
							
						
					
					
						commit
						fb5407a60b
					
				@ -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
 | 
			
		||||
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
 | 
			
		||||
        `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
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ services:
 | 
			
		||||
 | 
			
		||||
  mariadb:
 | 
			
		||||
    image: mariadb:latest
 | 
			
		||||
    container_name: mariadb
 | 
			
		||||
    environment:
 | 
			
		||||
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
 | 
			
		||||
      MYSQL_DATABASE: novadb
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user