-- Create dedicated Authority database for OIDC connection pool isolation.
--
-- Problem: When Concelier runs advisory sync jobs (heavy writes to
-- stellaops_platform), the shared connection pool starves Authority's
-- OIDC token validation, causing login timeouts.
--
-- Solution: Authority gets its own database with an independent Npgsql
-- connection pool. Concelier and other services continue using
-- stellaops_platform. Different database = separate pool automatically.
--
-- This script runs first (00-) to create the database before other
-- init scripts run against stellaops_platform.

SELECT 'CREATE DATABASE stellaops_authority OWNER stellaops'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'stellaops_authority')\gexec
