Sha256: 776c65a46a2944a11189bff4452c41327c381a8e49337e9a41560b59fbeded1f

Contents?: true

Size: 975 Bytes

Versions: 13

Compression:

Stored size: 975 Bytes

Contents

# This migration comes from erp_app (originally 20130410182333)
class UpdateMobileApplication < ActiveRecord::Migration
  def up
    unless columns(:applications).collect { |c| c.name }.include?('xtype')
      rename_column :applications, :base_url, :xtype

      user_management = MobileApplication.find_by_internal_identifier('user_management')
      if user_management.nil?
        MobileApplication.create(
            :description => 'User Mgmt',
            :icon => 'icon-user',
            :internal_identifier => 'user_management',
            :xtype => 'compass-erpapp-mobile-usermanagement-application'
        )
      else
        user_management.description = 'User Mgmt'
        user_management.xtype = 'compass-erpapp-mobile-usermanagement-application'
        user_management.save
      end
    end
  end

  def down
    if columns(:applications).collect { |c| c.name }.include?('xtype')
      rename_column :applications, :xtype, :base_url
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
knitkit-2.1.14 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
knitkit-2.1.13 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
erp_app-3.1.14 spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb
knitkit-2.1.12 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
erp_app-3.1.12 spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb
knitkit-2.1.9 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
knitkit-2.1.8 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
erp_app-3.1.10 spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb
erp_app-3.1.8 spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb
erp_txns_and_accts-3.1.1 spec/dummy/db/migrate/20130422155331_update_mobile_application.erp_app.rb
erp_commerce-3.1.3 spec/dummy/db/migrate/20130422155147_update_mobile_application.erp_app.rb
knitkit-2.1.5 spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb
erp_app-3.1.6 spec/dummy/db/migrate/20130422153811_update_mobile_application.erp_app.rb