我正在使用连接到SQLite后端的DataMapper。我需要在我的四个belongs_to列中创建一个Unique索引。这是表格。
class Score
include DataMapper::Resource
property :id, Serial
property :score, Integer
belongs_to :pageant
belongs_to :candidate
belongs_to :category
belongs_to :judge
#What we want is a UNIQUE INDEX on the four properties!
end
我做过的事情:
这个问题基本上有两个部分: