PDO::ERRMODE_EXCEPTION, ]); // Create the database if it doesn't exist $pdo->exec("CREATE DATABASE IF NOT EXISTS " . DB_NAME); // Now connect to the specific database $pdo = db(); // Create the tables $sql = file_get_contents(__DIR__ . '/schema.sql'); $pdo->exec($sql); echo "Database and tables created successfully."; } catch (PDOException $e) { die("Database setup failed: " . $e->getMessage()); }