-- Initialize main database and user
-- This runs first when PostgreSQL container starts

-- Create main database if it doesn't exist
SELECT 'CREATE DATABASE trading_bot'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'trading_bot')\gexec

-- Connect to the trading_bot database
\c trading_bot;

-- Create extensions we'll need
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "pg_trgm"; -- For fuzzy string matching