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: 20170517202155_adds_slugify_function.rb
    path of file: ./repos/catarse/db/migrate
    
    the code of the file until where you have to start completion: class Add
    
  def up
    execute <<-SQL
    CREATE OR REPLACE FUNCTION public.slugify(val text)
    RETURNS text AS
    $BODY$
        SELECT regexp_replace(regexp_replace(lower(unaccent(val)),'[^a-z0-9]+','-','g'),'^-|-$','','g');
    $BODY$
    LANGUAGE sql IMMUTABLE;
    GRANT SELECT ON "1".public_tags TO anonymous, web_user, admin;
    SQL
  end