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

25 lines
652 B
Ruby
Raw Permalink Normal View History

2024-03-16 20:53:29 +00:00
# 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