Sha256: eb27c1458c34b5eeff4693227fed0a29e5384810885bc42fa5ae95c3a931e898

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

class AddPartsFieldsToProducts < SolidusSupport::Migration[4.2]
  def self.up
    table = if data_source_exists?(:products)
              'products'
            elsif data_source_exists?(:spree_products)
              'spree_products'
    end

    change_table(table) do |t|
      t.column :can_be_part, :boolean, default: false, null: false
      t.column :individual_sale, :boolean, default: true, null: false
    end
  end

  def self.down
    table = if data_source_exists?(:products)
              'products'
            elsif data_source_exists?(:spree_products)
              'spree_products'
    end

    change_table(table) do |t|
      t.remove :can_be_part
      t.remove :individual_sale
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_product_assembly-1.4.0 db/migrate/20091029165620_add_parts_fields_to_products.rb
solidus_product_assembly-1.3.0 db/migrate/20091029165620_add_parts_fields_to_products.rb
solidus_product_assembly-1.2.0 db/migrate/20091029165620_add_parts_fields_to_products.rb
solidus_product_assembly-1.1.0 db/migrate/20091029165620_add_parts_fields_to_products.rb