private bool IsScriptRunErrorInfoTablePresent() { var statement = string.Format( @"SELECT Present = Count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[{0}]') AND type in (N'U')", ScriptsRunErrorInfo.GetTableName()); using (var connection = _configuration.GetConnection()) { return(connection.Query <int>(statement).FirstOrDefault() > 0); } }
private void UpdateScriptErrorForVersion(ScriptsRunErrorInfo info, long?versionId = null) { if (!versionId.HasValue) { return; } var update = string.Format("update [{0}] set [versioninfoid] = {1} where id = {2}", ScriptsRunErrorInfo.GetTableName(), versionId, info.Id.ToString()); using (var connection = _configuration.GetConnection()) { connection.Execute(update); } }
private void CheckForScriptsRunErrorInfoTable() { Logger.InfoFormat("Creating [{0}] table, if it does not exist..", ScriptsRunErrorInfo.GetTableName()); CreateInfoTable("scriptsrunerrorinfo_create.sql"); }