Example #1
0
    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);
    }
Example #2
0
 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);
     }
 }
Example #3
0
 private IEnumerable <ITypeObjectNameKey> GetDependenciesFor(Index index)
 {
     return(GetDependencies(index.IndexName, _ => true));
 }
Example #4
0
 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));
 }
Example #5
0
 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));
 }
Example #6
0
 private static bool IndicesToBeCreatedPredicate(Index index, IMetadata metadata, IComparerContext context)
 {
     return(!(metadata.MetadataIndices.Indices.TryGetValue(index.IndexName, out var otherIndex) && otherIndex.IsUserCreatedIndex));
 }