Sha256: d290196cdb7b5af4d76f4ceb0fa2514549108eb52c105d7d8412e5e8d636af3f

Contents?: true

Size: 924 Bytes

Versions: 5

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true
# This migration comes from spree (originally 20161123154034)

class AddAvailableToUsersAndRemoveDisplayOnFromShippingMethods < ActiveRecord::Migration[5.0]
  def up
    add_column(:spree_shipping_methods, :available_to_users, :boolean, default: true)
    execute("UPDATE spree_shipping_methods "\
             "SET available_to_users=#{quoted_false} "\
             "WHERE display_on='back_end'")
    remove_column(:spree_shipping_methods, :display_on)
  end

  def down
    add_column(:spree_shipping_methods, :display_on, :string)
    execute("UPDATE spree_shipping_methods "\
            "SET display_on='both' "\
            "WHERE (available_to_users=#{quoted_true}")
    execute("UPDATE spree_shipping_methods "\
            "SET display_on='back_end' "\
            "WHERE (available_to_users=#{quoted_false})")
    remove_column(:spree_shipping_methods, :available_to_users)
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
solidus_reports-1.0.0 spec/dummy/db/migrate/20211108200416_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_bank_transfer-0.1.0 spec/dummy/db/migrate/20190822093446_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_seo-1.0.2 spec/dummy/db/migrate/20181007234725_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_seo-1.0.1 spec/dummy/db/migrate/20181007234725_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_seo-1.0.0 spec/dummy/db/migrate/20181007234725_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb