mnemo_cards/mnemo_cards_backend/test_postgres.dart
Dmitry 4ed1839893
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
format and logs
2026-01-08 16:02:47 +03:00

32 lines
879 B
Dart

import 'package:postgres/postgres.dart' as pg;
void main() async {
print('Testing PostgreSQL connection...');
try {
// Direct PostgreSQL connection test
final connection = await pg.Connection.open(
pg.Endpoint(
host: 'localhost',
port: 5432,
database: 'mnemo_cards_dev',
username: 'mnemo_user',
password: 'dev_password_change_me',
),
settings: pg.ConnectionSettings(sslMode: pg.SslMode.disable),
);
print('✅ PostgreSQL connection successful');
// Test query
final result = await connection.execute('SELECT 1 as test');
print('✅ Query executed successfully');
await connection.close();
print('✅ Database connection closed');
print('🎉 PostgreSQL backend can connect to database!');
} catch (e, s) {
print('❌ Error: $e');
print('Stack trace: $s');
}
}