ensureTablesExist

Idempotently (re)create every registered table + index on the given connection. Safe to call repeatedly and from any DB access path: all CREATE statements use IF NOT EXISTS, so an intact schema is left untouched and a missing one is restored on the live connection.