diff --git a/db/migrate/20190831151649_add_consensos_to_asamblea_general.rb b/db/migrate/20190831151649_add_consensos_to_asamblea_general.rb new file mode 100644 index 0000000..a25eb5b --- /dev/null +++ b/db/migrate/20190831151649_add_consensos_to_asamblea_general.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Agrega todos los consensos sueltos a la asamblea general +class AddConsensosToAsambleaGeneral < ActiveRecord::Migration[5.2] + def up + return unless Rails.env == 'production' + + barca = Barca.find_or_create_by(nombre: 'Asamblea General') + + Consenso.where(barca_id: nil).find_each do |consenso| + barca.consensos << consenso + end + + barca.save + end + + def down; end +end