This repository contains T-SQL functions that help migrate databases to newer versions. The functions provide a simple API for checking whether objects exists and whether they have constraints.
My goal is to provide a simplish way to check the state of your database.
Previously, you would write code like this to check if a table exists (and drop it when it does):
IF OBJECT_ID('dbo.Scores', 'U') IS NOT NULL
DROP TABLE dbo.Scores;
That's kind of hard to read and even harder to remember. ('U' is for 'Table', duh doy!)
Instead you should be able to write this:
IF TableExists('dbo.Scores')
DROP TABLE dbo.Scores;
Run the scripts from this repository on your database to create the helper functions. When newer versions become available, you can safely update to the latest version by running the new scripts.
Click on a function name to go to its page on the wiki.