Monday, 26 August 2013

What is a best practice to handle unique DB constraints with testing?

What is a best practice to handle unique DB constraints with testing?

We recently added a uniqueness constraint on the production database, but
I can see some problems with this:
It is not tested: If the database gets moved or recreated, there is no
guarantee that the new database will have the same constraint.
The tests run against a test database, but it may or may not have the same
constraint. Even if I add the same constraint to test database, it could
be changed or deleted without modifying the production database.
So, what is a good way to handle DB constraints to ensure that they work
with the tests?

No comments:

Post a Comment