Reputation: 18815
Does anyone have a good solution for the following (potential) situation ?
Using a database migration tool such as fluentmigrator we add a migration that in and of itself is perfectly valid, but breaks some other database artifact in a way that won't be discovered until run time. For example removing a column that is referenced in the body of an existing stored proc.
I need to be able to validate the resulting schema in its entirety after a migration, what's the best and most efficient way to do this?
Upvotes: 3
Views: 682
Reputation: 146
Ideally it would be nice to have automated tests to verify your database objects, however this may not be achievable.
If you are looking for a way to recompile your objects (stored procedures, views, functions) a simple solution would be to create a migration profile with the sole purpose or dropping and recreating each of these objects.
This wouldn't detect semantic errors in your objects as a result of the migrations, but it would tell you if you've changed or dropped a column that causes compilation errors in dependent objects.
This profile could be executed on an ad hoc basis or as part of your continuous integration and deployment process.
Upvotes: 3