5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 14:16:22 +00:00
panel/db/migrate/20240226133022_add_instance_id_to_activity_pubs.rb

17 lines
439 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
# Relaciona instancias con sus actividades
class AddInstanceIdToActivityPubs < ActiveRecord::Migration[6.1]
def up
add_column :activity_pubs, :instance_id, :uuid, index: true
ActivityPub.all.find_each do |activity_pub|
activity_pub.update(instance: activity_pub&.object&.actor&.instance)
end
end
def down
remove_column :activity_pubs, :instance_id, :uuid, index: true
end
end