Enhance project documentation with updated architecture, PostgreSQL integration, and local development setup. Refine admin panel and GitHub Actions details. Remove Firebase configuration from .env.example and clarify database fallback mechanisms.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Kurzer Verbindungstest zur lokalen Postgres-Instanz.
|
||||
* Aufruf (im Projektroot):
|
||||
* php scripts/db-check.php
|
||||
*/
|
||||
require_once dirname(__DIR__) . '/config.php';
|
||||
require_once dirname(__DIR__) . '/helpers.php';
|
||||
|
||||
if (!extension_loaded('pdo_pgsql')) {
|
||||
fwrite(STDERR, "PHP-Extension pdo_pgsql fehlt. z. B.: sudo apt install php-pgsql\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$url = getenv('DATABASE_URL');
|
||||
if (!$url) {
|
||||
fwrite(STDERR, "DATABASE_URL ist nicht gesetzt. In .env eintragen (siehe .env.example).\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$pdo = get_db_connection();
|
||||
if (!$pdo) {
|
||||
fwrite(STDERR, "Keine DB-Verbindung zu: {$url}\n");
|
||||
fwrite(STDERR, "Prüfe: Docker läuft? docker compose -f docker-compose.dev.yml ps\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_db();
|
||||
|
||||
$count = (int) $pdo->query('SELECT COUNT(*) FROM recipes')->fetchColumn();
|
||||
echo "Verbindung OK. Rezepte in DB: {$count}\n";
|
||||
|
||||
if ($count > 0) {
|
||||
$stmt = $pdo->query("SELECT slug, data->'i18n'->'en'->>'title' AS title FROM recipes LIMIT 5");
|
||||
echo "\nBeispiel-Zeilen:\n";
|
||||
while ($row = $stmt->fetch()) {
|
||||
echo " - {$row['slug']}: {$row['title']}\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user