Sha256: 4cc190faaf81dbc56539924fe3eeb9a774e3427446cd9267a898a096e1ce88ce

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

class AddNestedToProductCategories < ActiveRecord::Migration
  def up
    add_column :shoppe_product_categories, :parent_id, :integer
    add_column :shoppe_product_categories, :lft, :integer
    add_column :shoppe_product_categories, :rgt, :integer
    add_column :shoppe_product_categories, :depth, :integer

    add_index :shoppe_product_categories, :lft
    add_index :shoppe_product_categories, :rgt
    
    add_column :shoppe_product_categories, :ancestral_permalink, :string
    add_column :shoppe_product_categories, :permalink_includes_ancestors, :boolean, default: false

    Shoppe::ProductCategory.reset_column_information
    Shoppe::ProductCategory.rebuild!
  end

  def down
    remove_column :shoppe_product_categories, :ancestral_permalink
    remove_column :shoppe_product_categories, :permalink_includes_ancestors

    remove_index :shoppe_product_categories, :lft
    remove_index :shoppe_product_categories, :rgt

    remove_column :shoppe_product_categories, :parent_id
    remove_column :shoppe_product_categories, :lft
    remove_column :shoppe_product_categories, :rgt
    remove_column :shoppe_product_categories, :depth
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
shoppe-1.1.2 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.1.1 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.1.0 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.0.9 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.0.8 db/migrate/20141026181718_add_nested_to_product_categories.rb
kylekthompson-shoppe-1.0.7 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.0.7 db/migrate/20141026181718_add_nested_to_product_categories.rb
shoppe-1.0.6 db/migrate/20141026181718_add_nested_to_product_categories.rb