20130512000001_create_recent_viewed.rb 888 B

1234567891011121314151617181920212223242526
  1. class CreateRecentViewed < ActiveRecord::Migration
  2. def up
  3. create_table :recent_views do |t|
  4. t.references :recent_view_object, :null => false
  5. t.column :o_id, :integer, :null => false
  6. t.column :created_by_id, :integer, :null => false
  7. t.timestamps
  8. end
  9. add_index :recent_views, [:o_id]
  10. add_index :recent_views, [:created_by_id]
  11. add_index :recent_views, [:created_at]
  12. add_index :recent_views, [:recent_view_object_id]
  13. create_table :recent_view_objects do |t|
  14. t.column :name, :string, :limit => 250, :null => false
  15. t.column :note, :string, :limit => 250, :null => true
  16. t.timestamps
  17. end
  18. add_index :recent_view_objects, [:name], :unique => true
  19. end
  20. def down
  21. drop_table :recent_views
  22. drop_table :recent_view_objects
  23. end
  24. end