As long as the constraints are maintained within the DB correctly, it's cool. Some constraints are more complicated than FK constraints allow. Implementing as close to the DB as possible is a good idea.
To do it in app code would be a terrible idea because it throws FK referential (and data) integrity out the window.