The controller was a static singleton: an eagerly created static instance
opened the root database during class initialization, and both the connection
and the path were static fields. A second operator profile in the same process
was therefore impossible, and ChatController's own "new DBController()" never
opened anything - it silently adopted the eagerly opened root connection.
- drop the eager static instance in favour of a lazily created default instance
- turn connection and path into instance state
- add a constructor taking a database file name relative to the application
directory plus a flag whether a missing file is seeded from the bundled
template
- create additional profile databases empty instead of seeding them: the
bundled template carries 3452 foreign callsigns and user_version 0, which
would show a new operator foreign data and trigger the full callsign
normalization rebuild. The schema is created by the existing table setup.
- remember the shutdown hook so closeDBConnection can deregister it; otherwise
every profile switch would leave another hook holding a dead connection
All SQL statements keep referencing the plain field and are unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hpa6bjie5qkeNG62y6FmXm