Do you know what’s in your database?

Last modified: 2011-02-28

When you are doing a release to production – do you always know what SQL objects should be in your database?

If someone were to ask what tables, sprocs, views etc should be present – could you easily tell them?

Ever had the experience where your dev team are all working off slightly different versions of a database? And when it comes to release time – no one knows for sure what should be the database?

If so, then the following short screencast, might be of interest.

It will show how DBTestUnit can help to avoid some of these issues.

(Screencast was created in Aug 2010)

Summary of how DBTestUnit can help
DBTestUnit can test that the correct SQL objects are present in the schema.

The sample SQLDatabase.cs shows how this can be done.

If an existing object is deleted/renamed or a new one created and the tests are not updated then they will fail.

If this type of test is also included as part of a database versioning strategy then this will effectively document what objects should be in each version of a database.


2 Responses to Do you know what’s in your database?

  1. David Cochran says:

    I see where this is going and I really don’t think it is reasonable. If someone asked me that question I would just use sys.objects to answer the question.

  2. You’re right – sys.objects/information_schema can be used to find out what sql objects are in your database schema at any given point in time. But – it does not tell you if that db schema is as expected eg a required sql object might not have been deployed/dropped by mistake. But I do see your point – maybe a better title would be ‘how do you know what should be in your database?’

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: