5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 01:06:21 +00:00
panel/db/migrate/20240227142019_create_fediblock_states.rb

28 lines
716 B
Ruby
Raw Permalink Normal View History

2024-02-27 16:43:46 +00:00
# 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|
2024-05-02 19:05:35 +00:00
FediblockState.create(site: deploy.site, fediblock: fediblock, aasm_state: 'disabled').tap(&:enable!)
2024-02-27 16:43:46 +00:00
end
end
end
def down
drop_table :fediblock_states
end
end