Not sure if this is a bug, or by design.
I had a connection to a test database (CapsuleTest). I edited the connection to a live database with same schema and renamed to CapsuleLive. Database id is still 3, but all the metadata I’d edited was lost, so I’m back to having to redefine all the foreign keys etc.
By design?