@startuml
skinparam backgroundColor White
skinparam defaultFontColor Black
skinparam shadowing false
skinparam componentStyle rectangle
skinparam ArrowColor Black
skinparam packageBorderColor Black
skinparam packageBackgroundColor #F7F9FC
skinparam componentBackgroundColor #E8F1FF
skinparam componentBorderColor Black

title /organization/list before fix (cached prepared plan failure)

actor Client #FFF6D5
component "Organization Handler\n(GET /organization/list)" as Handler #D9E8FF
component "SqlxAdapter::list_user_organizations\nSELECT o.* ..." as Adapter #D9E8FF
component "SQLx Statement Cache\n(persistent prepared statement)" as Cache #FFE3E3
database "PostgreSQL" as PG #FFF4CC
component "Schema Change\n(add/drop/type change in organization columns)" as DDL #FFD1DC

Client --> Handler : request
Handler --> Adapter : list_user_organizations(user_id)
Adapter --> Cache : execute prepared statement
Cache --> PG : run cached plan
DDL --> PG : alters organization row shape
PG --> Cache : ERROR cached plan must not change result type
Cache --> Adapter : query error
Adapter --> Handler : 500
Handler --> Client : 500 response
@enduml
