few fix and adding constraint not null on foreign_key