update SQL ForeignKey on new database schema