コード例 #1
0
        /// <summary>
        /// Outputs statements for dropping of aggregates that exist no more.
        /// </summary>
        /// <param name="writer">Writer the output should be written to.</param>
        /// <param name="oldSchema">Original schema.</param>
        /// <param name="newSchema">New schema.</param>
        /// <param name="searchPathHelper">Search path helper.</param>
        public static void Drop(StreamWriter writer, [NullGuard.AllowNull] PgSchema oldSchema, PgSchema newSchema, SearchPathHelper searchPathHelper)
        {
            if (oldSchema == null)
            {
                return;
            }

            // Drop aggregates that exist no more
            foreach (PgAggregate oldAggregate in oldSchema.Aggregates)
            {
                if (!newSchema.ContainsAggregate(oldAggregate.Signature))
                {
                    searchPathHelper.OutputSearchPath(writer);
                    writer.WriteLine();
                    writer.WriteLine(oldAggregate.DropSQL);
                }
            }
        }