Skip to content
kostyantyn edited this page Sep 3, 2012 · 1 revision

Create new entity

rails generate migration create_hydra_attributes
class CreateHydraAttributes < ActiveRecord::Migration
  def up
    create_hydra_entity :products do |t|
      # add here all other columns that should be in the entity table
      t.timestamps
    end
  end

  def down
    drop_hydra_entity :products
  end
end

Migrate existing table to hydra entity

rails generate migration move_products_to_hydra_attributes
class MoveProductsToHydraAttributes < ActiveRecord::Migration
  def up
    migrate_to_hydra_entity :products
  end

  def down
    rollback_from_hydra_entity :products
  end
end