You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20150624172046_change_payment_slip_delete_date.rb
    path of file: ./repos/catarse/db/migrate
    
    the code of the file until where you have to start completion: class Chang
    
  def down
    execute <<-SQL
    CREATE OR REPLACE FUNCTION can_delete(payments) RETURNS boolean AS $$
      SELECT
               $1.state = 'pending'
               AND
               (
                 SELECT count(1) AS total_of_days
                 FROM generate_series($1.created_at::date, current_date, '1 day') day
                 WHERE extract(dow from day) not in (0,1)
               )  >= 5
     $$ LANGUAGE sql;
    SQL
  end