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-laboratory-7.9.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.9.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.7.3 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.8.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.8.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.7.2 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.7.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-laboratory-7.7.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-laboratory-7.7.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.7.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.6.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.6.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.5.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-laboratory-7.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-acb12583b793/db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.5.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.4.1 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.4.0 db/migrate/20170621222902_introduce_settings_and_themes.rb
mumuki-domain-7.3.2 db/migrate/20170621222902_introduce_settings_and_themes.rb