- 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.
17 lines
634 B
PL/PgSQL
17 lines
634 B
PL/PgSQL
-- Initial database setup for Crypto Trading Bot Dashboard
|
|
-- This script runs when PostgreSQL container starts for the first time
|
|
|
|
-- Create extensions
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
-- Set timezone
|
|
SET timezone = 'UTC';
|
|
|
|
-- The database user is automatically created by Docker with the POSTGRES_USER and POSTGRES_PASSWORD
|
|
-- environment variables, so we don't need to create it here
|
|
|
|
-- Create initial comment
|
|
COMMENT ON DATABASE dashboard IS 'Crypto Trading Bot Dashboard Database';
|
|
|
|
-- Execute the clean schema file (without TimescaleDB hypertables for simpler setup)
|
|
\i /docker-entrypoint-initdb.d/schema_clean.sql |