@startuml
skinparam backgroundColor white
skinparam defaultFontColor black
skinparam ArrowColor black
skinparam shadowing false
skinparam rectangle {
  BorderColor black
  FontColor black
}

title Before: Provision SQL Fails on Legacy Email Tables

actor "Server Startup" as Startup
rectangle "ensure_auth_schema_provisioned" as Provision #E8F0FE
database "auth schema (athena)" as Db #FFF4CC
rectangle "sql/provision.sql" as Sql #FDECEC
rectangle "legacy email_send_failures table\n(no resolved/resolution_note/updated_at)" as Legacy #FDECEC

Startup --> Provision : boot
Provision --> Sql : execute raw SQL
Sql --> Db : CREATE TABLE IF NOT EXISTS email_send_failures
Db --> Legacy : table already exists\n(no shape upgrade)
Sql --> Db : CREATE INDEX ... (resolved)
Db --> Provision : ERROR column \"resolved\" does not exist
Provision --> Startup : startup abort

@enduml
