class Post < ActiveRecord::Base key :title key :permalink, :index => true, :limit => 50 key :comments_count, :as => :integer key :category, :as => :references, :index => true end Post.auto_upgrade!
when you execute
MyModel.auto_upgrade!, missing columns, indexes and tables will be created on the fly. Indexes and columns present in the db but not in your model schema will be deleted* also in your db.
Don’t go installing in your production apps just yet. Check out the extensive README for advanced usage.