I have a few migrations within identical helpers
private
def add_earthdistance_index table_name, options = {}
execute "CREATE INDEX %s_earthdistance_ix ON %s USING gist (ll_to_earth(%s, %s));" %
[table_name, table_name, 'latitude', 'longitude']
end
def remove_earthdistance_index table_name
execute "DROP INDEX %s_earthdistance_ix;" % [table_name]
end
And I'm trying to avoid copy-paste them every time. Is there any way to share code between migrations without monkey-patching the base class? I want to find something like concerns
for models.
concerns
for models. – Partlow