[WIP] [feature/migrations] Migrations for 3.1

Updated PR which is based on 3.1 rather than 3.0