-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_db.sh
More file actions
executable file
·25 lines (22 loc) · 1.02 KB
/
Copy pathtest_db.sh
File metadata and controls
executable file
·25 lines (22 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# =============================================================================
# test_db.sh — проверка подключения к PostgreSQL (Neon)
# =============================================================================
# Использование: ./test_db.sh
#
# Что делает:
# 1. Загружает DATABASE_URL из .env
# 2. Подключается к Neon PostgreSQL
# 3. Показывает статистику БД и последние 5 отправленных новостей
# 4. Тестирует генерацию hash и проверку дубликатов
#
# Требует: DATABASE_URL в .env или в окружении
# =============================================================================
# Load environment variables
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
echo "🧪 Testing PostgreSQL Database Connection..."
echo ""
# Run the test (moved from root to cmd/testdb/ to avoid package main conflict)
go run cmd/testdb/main.go