Method: DynamicMigrations::Postgres::Generator::Function#update_function

Defined in:
lib/dynamic_migrations/postgres/generator/function.rb

#update_function(function, code_comment = nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/dynamic_migrations/postgres/generator/function.rb', line 46

def update_function function, code_comment = nil
  fn_sql = function.definition.strip

  add_fragment schema: function.schema,
    table: function.triggers.first&.table,
    migration_method: :update_function,
    object: function,
    code_comment: code_comment,
    migration: <<~RUBY
      update_function :#{function.name} do
        <<~SQL
          #{indent fn_sql, 2}
        SQL
      end
    RUBY
end