protected virtual IEnumerable <MigrationOperation> Diff(
            [NotNull] IEntityType source,
            [NotNull] IEntityType target,
            [NotNull] DiffContext diffContext)
        {
            var sourceAnnotations = Annotations.For(source);
            var targetAnnotations = Annotations.For(target);

            var schemaChanged = sourceAnnotations.Schema != targetAnnotations.Schema;
            var renamed       = sourceAnnotations.TableName != targetAnnotations.TableName;

            if (schemaChanged || renamed)
            {
                yield return(new RenameTableOperation
                {
                    Schema = sourceAnnotations.Schema,
                    Name = sourceAnnotations.TableName,
                    NewSchema = schemaChanged ? targetAnnotations.Schema : null,
                    NewName = renamed ? targetAnnotations.TableName : null
                });
            }

            diffContext.AddMapping(source, target);

            var operations = Diff(GetPropertiesInHierarchy(source), GetPropertiesInHierarchy(target), diffContext)
                             .Concat(Diff(source.GetKeys(), target.GetKeys(), diffContext))
                             .Concat(Diff(GetIndexesInHierarchy(source), GetIndexesInHierarchy(target), diffContext));

            foreach (var operation in operations)
            {
                yield return(operation);
            }
        }
        protected virtual IEnumerable <MigrationOperation> Diff(
            [NotNull] IEnumerable <IProperty> source,
            [NotNull] IEnumerable <IProperty> target,
            [NotNull] DiffContext diffContext)
        => DiffCollection(
            source,
            target,
            (s, t) =>
        {
            diffContext.AddMapping(s, t);

            return(Diff(s, t));
        },
            t => Add(t),
            Remove,
            (s, t) => string.Equals(s.Name, t.Name, StringComparison.OrdinalIgnoreCase),
            (s, t) => string.Equals(
                Annotations.For(s).ColumnName,
                Annotations.For(t).ColumnName,
                StringComparison.OrdinalIgnoreCase));