Migrate recorder database (PostgreSQL) to HA OS


I have been running HA Core in a Docker environment with recorder logging to a seperate PostgrSQL container for the past couple of years. I want to move my install over to Home Assistant OS on a Raspberry PIm however I want to bring over all my energy data that has been accumulated.

Is there a way to migrate this data over ?
I see there are a few tables that relate to statistics - can I simply import (replace) the meta and statistics tables and expect everything to just work. My concern is that these tables have indices defined that may be referenced elsewhere.