Refactor database configuration and schema for Crypto Trading Bot Platform

- Updated `docker-compose.yml` to remove hardcoded passwords, relying on environment variables for PostgreSQL and Redis configurations.
- Modified `env.template` to reflect new password settings and ensure secure handling of sensitive information.
- Introduced a new `database/connection.py` file for improved database connection management, including connection pooling and session handling.
- Updated `database/models.py` to align with the new schema in `schema_clean.sql`, utilizing JSONB for optimized data storage.
- Enhanced `setup.md` documentation to clarify the initialization process and emphasize the importance of the `.env` file for configuration.
- Added a new `scripts/init_database.py` script for automated database initialization and verification, ensuring all tables are created as expected.
This commit is contained in:
Vasily.onl
2025-05-30 18:20:38 +08:00
parent 8121ce0430
commit 73b7e8bb9d
12 changed files with 781 additions and 142 deletions

View File

@@ -1,15 +1,15 @@
# Database Configuration
POSTGRES_DB=dashboard
POSTGRES_USER=dashboard
POSTGRES_PASSWORD=dashboard123
POSTGRES_PASSWORD=sdkjfh534^jh
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
DATABASE_URL=postgresql://dashboard:dashboard123@localhost:5432/dashboard
POSTGRES_PORT=5434
DATABASE_URL=postgresql://dashboard:sdkjfh534^jh@localhost:5434/dashboard
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_PASSWORD=redis987secure
# OKX API Configuration
OKX_API_KEY=your_okx_api_key_here