add unique index
This commit is contained in:
parent
22b9f92c27
commit
6e0315965b
2 changed files with 11 additions and 1 deletions
9
db/migrate/20110330175950_tag_uniqueness.rb
Normal file
9
db/migrate/20110330175950_tag_uniqueness.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class TagUniqueness < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :taggings, [:taggable_id, :taggable_type, :context, :tag_id], :unique => true, :name => 'index_taggings_uniquely'
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :taggings, :name => 'index_taggings_uniquely'
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110328202414) do
|
||||
ActiveRecord::Schema.define(:version => 20110330175950) do
|
||||
|
||||
create_table "aspect_memberships", :force => true do |t|
|
||||
t.integer "aspect_id", :null => false
|
||||
|
|
@ -328,6 +328,7 @@ ActiveRecord::Schema.define(:version => 20110328202414) do
|
|||
end
|
||||
|
||||
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
||||
add_index "taggings", ["taggable_id", "taggable_type", "context", "tag_id"], :name => "index_taggings_uniquely", :unique => true
|
||||
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
||||
|
||||
create_table "tags", :force => true do |t|
|
||||
|
|
|
|||
Loading…
Reference in a new issue