Improve constraints on database