mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-28 17:16:21 +00:00
25 lines
652 B
Ruby
25 lines
652 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
# Guarda la mención en la tabla de actores
|
||
|
class AddMentionToActors < ActiveRecord::Migration[6.1]
|
||
|
def up
|
||
|
add_column :activity_pub_actors, :mention, :string, null: true
|
||
|
|
||
|
actor_types = %w[
|
||
|
ActivityPub::Object::Application
|
||
|
ActivityPub::Object::Group
|
||
|
ActivityPub::Object::Organization
|
||
|
ActivityPub::Object::Person
|
||
|
ActivityPub::Object::Service
|
||
|
]
|
||
|
|
||
|
ActivityPub::Object.where(type: actor_types).where.not(content: {}).find_each do |object|
|
||
|
ActivityPub::Actor.find_by_uri(object.uri)&.save
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
remove_column :activity_pub_actors, :mention
|
||
|
end
|
||
|
end
|