Sha256: 627b04bfe11719ae6cddcbf6c5bb9c1b7db801eb4b6ad83c3762752edf7bd6a0

Contents?: true

Size: 1.72 KB

Versions: 97

Compression:

Stored size: 1.72 KB

Contents

class IntroduceSettingsAndThemes < ActiveRecord::Migration[4.2]
  def change
    add_column :organizations, :settings, :text, default: "{}", null: false
    add_column :organizations, :theme, :text, default: "{}", null: false
    add_column :organizations, :profile, :text, default: "{}", null: false

    Organization.all.each do |organization|
      organization.profile = Mumuki::Domain::Organization::Profile.new(
        logo_url: organization[:logo_url],
        locale: organization[:locale],
        description: organization[:description],
        contact_email: organization[:contact_email],
        terms_of_service: organization[:terms_of_service],
        community_link: organization[:community_link]
      )
      organization.settings = Mumuki::Domain::Organization::Settings.new(
        login_methods: organization[:login_methods],
        raise_hand_enabled: organization[:raise_hand_enabled],
        public: organization[:public]
      )
      organization.theme = Mumuki::Domain::Organization::Theme.new(
        theme_stylesheet_url: organization[:theme_stylesheet_url],
        extension_javascript_url: organization[:extension_javascript_url]
      )
      organization.save!
    end

    remove_column :organizations, :login_methods
    remove_column :organizations, :raise_hand_enabled
    remove_column :organizations, :public
    remove_column :organizations, :locale
    remove_column :organizations, :logo_url
    remove_column :organizations, :theme_stylesheet_url
    remove_column :organizations, :extension_javascript_url
    remove_column :organizations, :community_link
    remove_column :organizations, :description
    remove_column :organizations, :contact_email
    remove_column :organizations, :terms_of_service
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
mumuki-domain-9.23.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.22.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.22.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.21.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.20.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.19.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.18.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.17.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.16.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.15.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.14.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.14.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.13.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.13.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.12.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.11.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.10.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.9.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.8.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-9.8.0 db/migrate/20170621222902_introduce_settings_and_themes.rb