-- Runs ONCE on pipeline_postgres as superuser to create the bit_flight_deck DB and user.
--
-- Usage:
--   docker exec -e PGPASSWORD=<superuser-password> -i pipeline_postgres \
--     psql -h localhost -U pipeline_user -d postgres \
--     -v password=$(grep PG_PASSWORD ../.env | cut -d= -f2) \
--     -f infra/init-bit-flight-deck-db.sql
--
-- Or inline (less safe, password visible in shell history):
--   psql ... -v password='your-password' -f infra/init-bit-flight-deck-db.sql

CREATE DATABASE bit_flight_deck;
CREATE USER bit_flight_deck_user WITH PASSWORD :'password';
GRANT ALL PRIVILEGES ON DATABASE bit_flight_deck TO bit_flight_deck_user;
ALTER DATABASE bit_flight_deck OWNER TO bit_flight_deck_user;
