[Scripts] - Added foreign keys creation on all tables and fixed minor bugs