-- 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'; -- Create initial user with appropriate permissions (if not exists) DO $$ BEGIN IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'dashboard') THEN CREATE ROLE dashboard WITH LOGIN PASSWORD 'dashboard123'; END IF; END $$; -- Grant permissions GRANT ALL PRIVILEGES ON DATABASE dashboard TO dashboard; GRANT ALL ON SCHEMA public TO dashboard; -- Create initial comment COMMENT ON DATABASE dashboard IS 'Crypto Trading Bot Dashboard Database'; -- Execute the main schema file \i /docker-entrypoint-initdb.d/schema.sql