Created
February 15, 2011 02:16
-
-
Save knowtheory/826987 to your computer and use it in GitHub Desktop.
Demonstrating how to do composite indexes in DataMapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dm-core' | |
require 'dm-migrations' | |
DataMapper.setup(:default, "mysql://localhost/test") | |
class TotallyContrivedForThisExample | |
include DataMapper::Resource | |
property :id, Serial # already part of the primary key | |
property :plerp, String, :key => true # Adds this to the primary key | |
# a composite index is created called "index_totally_contrived_for_this_example_stuff" | |
property :one, Integer, :index => [:stuff] | |
property :two, Integer, :index => [:stuff] | |
property :three, String, :index => [:stuff] | |
end | |
DataMapper.auto_migrate! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OH MY GOD