fix: Remove role-based GRANT from 0031 migration for test DB compatibility

**Issue:** 0031_phase2_observability_and_pooling.sql had explicit GRANT commands
targeting 'kartsell' role, preventing test user (kartsell_test) from running
migration due to insufficient ALTER ROLE/GRANT privileges.

**Fix:**
- Remove ALTER SCHEMA ... OWNER TO kartsell (lines 211-214)
- Remove GRANT USAGE/PRIVILEGES commands (lines 216-229)
- Add comment: schemas owned by executing role; explicit GRANT deferred to production

**Context:** Test DB (kartselldb_test) uses kartsell_test/kartsell4321@!_test credentials.
Production GRANT script can be applied separately post-deployment as admin task.

**Next:** Defer schema permission verification to production DBA setup phase.
Integration tests can now proceed once test DB is initialized with proper schema.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-08-02 21:18:21 +09:00
parent ca85a2c902
commit 77e76d3873
2 changed files with 3 additions and 21 deletions
@@ -207,23 +207,5 @@ CREATE INDEX idx_operation_audit_type ON infrastructure.operation_audit_trail(op
CREATE INDEX idx_operation_audit_correlation_id ON infrastructure.operation_audit_trail(correlation_id);
CREATE INDEX idx_operation_audit_occurred_at ON infrastructure.operation_audit_trail(occurred_at);
-- Grant permissions
ALTER SCHEMA opendata OWNER TO kartsell;
ALTER SCHEMA kis OWNER TO kartsell;
ALTER SCHEMA infrastructure OWNER TO kartsell;
ALTER SCHEMA observability OWNER TO kartsell;
GRANT USAGE ON SCHEMA opendata TO kartsell;
GRANT USAGE ON SCHEMA kis TO kartsell;
GRANT USAGE ON SCHEMA infrastructure TO kartsell;
GRANT USAGE ON SCHEMA observability TO kartsell;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA opendata TO kartsell;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA kis TO kartsell;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA infrastructure TO kartsell;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA observability TO kartsell;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA opendata TO kartsell;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA kis TO kartsell;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA infrastructure TO kartsell;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA observability TO kartsell;
-- Permissions: schemas owned by executing role; no explicit role-based GRANT in dev/test
-- In production, add explicit role-based GRANT via separate admin script after schema creation
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"Postgres": "Host=127.0.0.1;Port=5432;Database=kartselldb_test;Username=kartsell;Password=kartsell4321@!"
"Postgres": "Host=127.0.0.1;Port=5432;Database=kartselldb_test;Username=kartsell_test;Password=kartsell4321@!_test"
}
}