public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { return(0 == connection.ExecuteScalarSql <int>(String.Format(@" SELECT COUNT(*) FROM sys.service_contract_message_usages c JOIN sys.service_message_types m ON (c.message_type_id = m.message_type_id) WHERE m.name = '{0}'" , Name.Object))); }
public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { return(0 == connection.ExecuteScalarSql <int>(String.Format(@" SELECT COUNT(*) FROM sys.service_queues q JOIN sys.service_queue_usages u ON (q.object_id = u.service_queue_id) WHERE q.object_id = OBJECT_ID('{0}')" , Name.SchemaQualifiedObject))); }
public override bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { // we can drop a udt unless it is used in a table return(connection.ExecuteScalarSql <int>( "SELECT COUNT(*) FROM sys.types t JOIN sys.columns c ON (t.user_type_id = c.user_type_id) WHERE t.Name = @Name", new Dictionary <string, object>() { { "Name", Name.Object } }) == 0); }
public override bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { // we can drop a function as long as there are no schemes using it return(connection.ExecuteScalarSql <int>( "SELECT COUNT(*) FROM sys.partition_functions p JOIN sys.partition_schemes s ON (p.function_id = s.function_id) WHERE p.name = @Name", new Dictionary <string, object>() { { "Name", Name.Object } }) == 0); }
public override bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { // azure can't drop the clustered index, so we have to warn if we are attempting to modify that if (context.IsAzure) { if (Sql.IndexOf("NONCLUSTERED", StringComparison.OrdinalIgnoreCase) == -1 && Sql.IndexOf("CLUSTERED", StringComparison.OrdinalIgnoreCase) != -1) { return(false); } } return(true); }
public override bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { // we can drop a scheme as long as there are no tables using it return(connection.ExecuteScalarSql <int>(@"SELECT COUNT(*) FROM sys.partition_schemes s WHERE s.name = @Name AND ( s.data_space_id IN (SELECT data_space_id FROM sys.indexes) OR s.data_space_id IN (SELECT lob_data_space_id FROM sys.tables) OR s.data_space_id IN (SELECT filestream_data_space_id FROM sys.tables)) " , new Dictionary <string, object>() { { "Name", Name.Object } }) == 0); }
public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { // azure can't drop the clustered index, so we have to warn if we are attempting to modify that if (context.IsAzure) { if (Sql.IndexOf("NONCLUSTERED", StringComparison.OrdinalIgnoreCase) == -1 && Sql.IndexOf("CLUSTERED", StringComparison.OrdinalIgnoreCase) != -1) { return(false); } } return(0 == connection.ExecuteScalarSql <int>(String.Format(@"SELECT COUNT(*) FROM sys.xml_indexes i WHERE i.object_id = OBJECT_ID('{0}')" , Name.SchemaQualifiedTable))); }
/// <summary> /// Determine if this is a type of object that we can modify. /// </summary> /// <param name="type">The type of the object.</param> /// <returns>True if we know how to drop the object.</returns> internal bool CanModify(SchemaInstaller.InstallContext context, RecordingDbConnection connection) { return(connection.DoNotLog(() => _implementation.CanModify(context, connection))); }
public virtual bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { return(CanDrop(context, connection)); }
public virtual bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { return(true); }
public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { return(false); }
public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { // assume that logins can be used across the server return(false); }
public override bool CanModify(SchemaInstaller.InstallContext context, IDbConnection connection) { return(true); }
public override bool CanDrop(SchemaInstaller.InstallContext context, IDbConnection connection) { return(0 == connection.ExecuteScalarSql <int>(String.Format("SELECT COUNT(*) FROM sys.objects o WHERE o.schema_id = SCHEMA_ID('{0}')", Name.Object))); }