Sha256: a01b885ddac3c4b7ce593669b70bccfa9ad59538271d391bf529efc958528da5

Contents?: true

Size: 451 Bytes

Versions: 4

Compression:

Stored size: 451 Bytes

Contents

require 'skr/db/migration_helpers'

class CreateCreateCombinedUomViews < ActiveRecord::Migration
    def up
        execute <<-EOS
        create view #{skr_prefix}combined_uom as
          select
            uom.id as skr_uom_id,
            case when size = 1 then code else code||'/'||size end as combined_uom
          from #{skr_prefix}uoms uom
        EOS
    end

    def down
        execute "drop view #{skr_prefix}combined_uom"
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stockor-0.5.0 db/migrate/20160307022705_create_create_combined_uom_views.rb
stockor-0.4.0 db/migrate/20160307022705_create_create_combined_uom_views.rb
stockor-0.3.0 db/migrate/20160307022705_create_create_combined_uom_views.rb
stockor-0.2 db/migrate/20160307022705_create_create_combined_uom_views.rb