protected virtual AlterDatabaseOperation PostFilterOperation(AlterDatabaseOperation operation)
        {
            HandleCharSetDelegation(operation, DelegationModes.ApplyToDatabases);

            ApplyCollationAnnotation(operation, (operation, collation) => operation.Collation ??= collation);
            ApplyCollationAnnotation(operation.OldDatabase, (operation, collation) => operation.Collation ??= collation);
            HandleCollationDelegation(operation, DelegationModes.ApplyToDatabases, o => o.Collation = null);

            // Ensure, that no properties have been added by the EF Core team in the meantime.
            // If they have, they need to be checked below.
            AssertMigrationOperationProperties(
                operation,
                new[]
            {
                nameof(AlterDatabaseOperation.OldDatabase),
                nameof(AlterDatabaseOperation.Collation),
            });

            // Ensure, that this hasn't become an empty operation.
            return(operation.Collation != operation.OldDatabase.Collation ||
                   operation.IsReadOnly != operation.OldDatabase.IsReadOnly ||
                   HasDifferences(operation.GetAnnotations(), operation.OldDatabase.GetAnnotations())
                ? operation
                : null);
        }
        protected virtual void Generate([NotNull] AlterDatabaseOperation operation, [NotNull] IndentedStringBuilder builder)
        {
            Check.NotNull(operation, nameof(operation));
            Check.NotNull(builder, nameof(builder));

            builder.Append(".AlterDatabase()");

            using (builder.Indent())
            {
                Annotations(operation.GetAnnotations(), builder);
                OldAnnotations(operation.OldDatabase.GetAnnotations(), builder);
            }
        }