Backport: Migrate schema when opening database

Backport of !680 (merged)

Merge request reports

Loading