5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 15:56:20 +00:00
panel/db/migrate/20240223170317_add_actor_to_activities.rb

19 lines
489 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Relaciona Actor con Activity
class AddActorToActivities < ActiveRecord::Migration[6.1]
def up
add_column :activity_pub_activities, :actor_id, :uuid, index: true
ActivityPub::Activity.find_each do |activity|
actor = ActivityPub::Actor.find_by(uri: activity.content['actor'])
activity.update(actor: actor) if actor.present?
end
end
def down
remove_column :activity_pub_activities, :actor_id, :uuid, index: true
end
end