Move transaction logging into the database.