Migrate from 0.3.2 to 0.4.0

kostyantyn edited this page Sep 12, 2012 · 5 revisions

Include hydra_attribute module

Starting from 0.4.0 version, HydraAttribute::ActiveRecord module should be included instead of calling use_hydra_attributes method. For example:

class Product < ActiveRecord::Base
  include HydraAttribute::ActiveRecord

Add hydra_set_id column to entity

The column hydra_set_id with type integer should be added to the entity table.

rails generate migration add_hydra_set_id_to_products
class AddHydraSetIdToProducts < ActiveRecord::Migration
  def up
    add_column :products, :hydra_set_id, :integer
    add_index  :products, :hydra_set_id

  def down 

Notice: the down method should be blank otherwise rollback_from_hydra_entity or drop_hydra_entity will throw exception.