-- Initialize PostgreSQL database for Software Release Management
-- This script runs during container initialization

-- Create additional users if needed
-- CREATE USER srm_app WITH PASSWORD 'secure_password';
-- GRANT CONNECT ON DATABASE software_release_management TO srm_app;

-- Enable UUID extension if needed in the future
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- Enable PostGIS extension if geographical features are needed
-- CREATE EXTENSION IF NOT EXISTS postgis;

-- Set timezone
SET timezone = 'UTC';

-- Create schema for application (optional, using public by default)
-- CREATE SCHEMA IF NOT EXISTS srm;

-- Grant permissions
-- GRANT USAGE ON SCHEMA public TO srm_app;
-- GRANT CREATE ON SCHEMA public TO srm_app;

-- Log initialization
DO $$
BEGIN
    RAISE NOTICE 'Database initialized for Software Release Management';
    RAISE NOTICE 'Version: PostgreSQL %', version();
    RAISE NOTICE 'Current time: %', NOW();
END $$;