5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 23:06:22 +00:00
panel/db/migrate/20240316203721_add_mention_to_actors.rb

24 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