Sha256: fbb7db2813f6d5063f84d55cadd49a06a95695a0e43deaed1bb583452c2e7ccd
Contents?: true
Size: 861 Bytes
Versions: 3
Compression:
Stored size: 861 Bytes
Contents
class AddRatingToProducts < ActiveRecord::Migration def self.up if table_exists?('products') add_column :products, :avg_rating, :decimal, :default => 0.0, :null => false, :precision => 7, :scale => 5 add_column :products, :reviews_count, :integer, :default => 0, :null => false elsif table_exists?('spree_products') add_column :spree_products, :avg_rating, :decimal, :default => 0.0, :null => false, :precision => 7, :scale => 5 add_column :spree_products, :reviews_count, :integer, :default => 0, :null => false end end def self.down if table_exists?('products') remove_column :products, :reviews_count remove_column :products, :avg_rating elsif table_exists?('spree_products') remove_column :spree_products, :reviews_count remove_column :spree_products, :avg_rating end end end
Version data entries
3 entries across 3 versions & 2 rubygems