public override void Initialize() { var indexSegments = Execute(IndexSegmentCommandText) .Select(o => IndexSegment.CreateFrom(SqlHelper, o)) .ToLookup(x => x.IndexName); m_Indices = Execute(IndexCommandText) .Select(o => Index.CreateFrom(SqlHelper, o, indexSegments)) .ToDictionary(x => x.IndexName); m_IndicesByRelation = m_Indices.Values .ToMultiDictionary(x => x.RelationName); }
private IEnumerable <Command> DropCreateHelper(Index index, IMetadata other, IComparerContext context) { if (!context.DroppedObjects.Contains(index.TypeObjectNameKey)) { foreach (var item in index.Drop(Metadata, other, context)) { yield return(item); } } foreach (var item in index.Create(Metadata, other, context)) { yield return(item); } }
private IEnumerable <ITypeObjectNameKey> GetDependenciesFor(Index index) { return(GetDependencies(index.IndexName, _ => true)); }
private static bool IndicesToBeDroppedPredicate(Index index, IMetadata metadata, IComparerContext context) { return(!context.DroppedObjects.Contains(index.TypeObjectNameKey) && !(metadata.MetadataIndices.Indices.TryGetValue(index.IndexName, out var otherIndex) && otherIndex.IsUserCreatedIndex)); }
private static bool IndicesToBeDropCreatedPredicate(Index index, IMetadata metadata, IComparerContext context) { return(metadata.MetadataIndices.Indices.TryGetValue(index.IndexName, out var otherIndex) && index != otherIndex && !index.CanAlter(otherIndex)); }
private static bool IndicesToBeCreatedPredicate(Index index, IMetadata metadata, IComparerContext context) { return(!(metadata.MetadataIndices.Indices.TryGetValue(index.IndexName, out var otherIndex) && otherIndex.IsUserCreatedIndex)); }