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

18 lines
489 B
Ruby

# 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