Sha256: 85d47d820fa3f47aa026a3350277d69a91e18fdefe6165b5aae07b9e50f7f065

Contents?: true

Size: 911 Bytes

Versions: 12

Compression:

Stored size: 911 Bytes

Contents

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

12 entries across 12 versions & 1 rubygems

Version Path
erp_app-4.0.0 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.16 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.15 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.14 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.13 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.12 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.11 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.10 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.9 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.8 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.7 db/migrate/20130410182333_update_mobile_application.rb
erp_app-3.1.6 db/migrate/20130410182333_update_mobile_application.rb