Files
kite/docker/postgres/initdb.d/01-init-users.sql
T
curo1305 a5994d9ff4 chore: commit pending phase-3 work and add TEST_ACCOUNTS.md
Includes planning artifacts (03-CONTEXT, 03-DISCUSSION-LOG, 03-02-SUMMARY),
integration test script, MinIO/auth/docker fixes, and local dev account reference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 11:30:56 +02:00

16 lines
895 B
SQL

-- docker/postgres/initdb.d/01-init-users.sql
-- Runs as the POSTGRES_USER (postgres superuser) on first container start only.
-- Note: Table-level grants (USAGE ON SCHEMA public, SELECT/INSERT/UPDATE/DELETE ON ALL TABLES,
-- ALTER DEFAULT PRIVILEGES) are issued by the Alembic initial migration (Plan 03), not here.
-- Migration user: DDL privileges (CREATE TABLE, ALTER TABLE, CREATE INDEX)
CREATE USER docuvault_migrate WITH PASSWORD 'changeme_migrate';
GRANT ALL PRIVILEGES ON DATABASE docuvault TO docuvault_migrate;
-- PostgreSQL 15+: schema CREATE is not granted by default even with GRANT ALL ON DATABASE
GRANT ALL ON SCHEMA public TO docuvault_migrate;
-- App user: runtime DML only (SELECT, INSERT, UPDATE, DELETE) — no DDL
CREATE USER docuvault_app WITH PASSWORD 'changeme_app';
GRANT CONNECT ON DATABASE docuvault TO docuvault_app;
GRANT USAGE ON SCHEMA public TO docuvault_app;