5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-21 22:46:21 +00:00
panel/db/migrate/20240227142019_create_fediblock_states.rb
2024-05-02 16:05:35 -03:00

27 lines
716 B
Ruby

# frozen_string_literal: true
# La relación entre sitios y fediblocks
class CreateFediblockStates < ActiveRecord::Migration[6.1]
def up
create_table :fediblock_states, id: :uuid do |t|
t.timestamps
t.belongs_to :site
t.uuid :fediblock_id, index: true
t.string :aasm_state
t.index %i[site_id fediblock_id], unique: true
end
# Todas las listas están activas por defecto
DeploySocialDistributedPress.find_each do |deploy|
ActivityPub::Fediblock.find_each do |fediblock|
FediblockState.create(site: deploy.site, fediblock: fediblock, aasm_state: 'disabled').tap(&:enable!)
end
end
end
def down
drop_table :fediblock_states
end
end