Sha256: be1232f3f3ccc5103ed1b60e33cf8f66bacbeb8504b994ca40523937ad127367

Contents?: true

Size: 925 Bytes

Versions: 10

Compression:

Stored size: 925 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

10 entries across 10 versions & 2 rubygems

Version Path
solidus_prototypes-1.6.0 spec/dummy/db/migrate/20231107091958_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.5.1 spec/dummy/db/migrate/20231107091958_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.5.0 spec/dummy/db/migrate/20231107091958_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.4.0 spec/dummy/db/migrate/20231107091958_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.3.0 spec/dummy/db/migrate/20230326093416_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_reports-1.2.0 spec/dummy/db/migrate/20230326095724_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.2.0 spec/dummy/db/migrate/20221122203142_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.1.1 spec/dummy/db/migrate/20221014070457_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_reports-1.1.0 spec/dummy/db/migrate/20221012211948_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb
solidus_prototypes-1.1.0 spec/dummy/db/migrate/20221012201056_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb