Sha256: 02c2f2f9b5467ef982a6ed55c238069923d1e4553dcbfbf0125e1ae02b29b099

Contents?: true

Size: 497 Bytes

Versions: 9

Compression:

Stored size: 497 Bytes

Contents

# frozen_string_literal: true

class AddAvailableAuthorizationsToOrganization < ActiveRecord::Migration[5.0]
  class Organization < ApplicationRecord
    self.table_name = :decidim_organizations
  end

  def change
    add_column :decidim_organizations, :available_authorizations, :string, array: true, default: []

    workflows = Decidim::Verifications.workflows.map(&:name)
    Organization.find_each do |org|
      org.update_attributes!(available_authorizations: workflows)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.9.3 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.9.2 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.9.1 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.9.0 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.8.4 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.8.3 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.8.2 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.8.1 db/migrate/20170313095436_add_available_authorizations_to_organization.rb
decidim-core-0.8.0 db/migrate/20170313095436_add_available_authorizations_to_organization.rb