tSQLt-org / tSQLt

The official tSQLt repository. (Download at: http://tSQLt.org/downloads )
http://tSQLt.org
413 stars 102 forks source link

How to remove (clean-up) tsqlt from the SQL Server? #186

Open ZedZipDev opened 1 year ago

ZedZipDev commented 1 year ago

The script tsqlt.clas.sql is not re-enterable. I run it first time and received a lot of errors like owner sid of the db differs from owner's sid of master db. But after the 2nd run of the same script I have received messages about object already exists etc. I am sure need to avoid this kind of statements but the script contains them CREATE SCHEMA tSQLt; GO Need to check if exists etc. Ok. How to remove (clean-up) tsqlt from the SQL Server?

mbt1 commented 1 year ago

The tSQLt.class.sql script is idempotent, as it automatically removes tSQLt completely before creating new objects. However, if the install fails due to unforeseen circumstances, like a previously corrupt database or permission issues, that uninstall portion of the script might not work correctly.

To address that, we should add an independent uninstall tSQLt script to the download. Note: In the case of a previously corrupted database, this clearly can do only a best effort.

Thank you for bringing this to our attention.