WIP: Sqlite migration and foreignKey support

Just need the PR id in another ticket. Maybe it's done in a few days.