createSnapshot

Freezes the current database state as a PostgreSQL TEMPLATE database and returns a DatabaseSnapshot that can vend independent fresh copies via DatabaseSnapshot.newDataSource.

The original TestDataSource remains open and usable after this call. HikariCP's idle connections are evicted (so the pool reconnects cleanly after the snapshot), and any remaining PostgreSQL backends are terminated via pg_terminate_backend to satisfy PostgreSQL's zero-connections requirement for TEMPLATE databases.

Safe to call on a shared (companion-object) datasource — only idle connections are evicted and only active backends at the moment of the call are terminated. No transactions should be in flight during a @BeforeAll setup phase.