fixed the uniqueness on indecies and foreign key constrains in the down migrations
This commit is contained in:
parent
2b081df9fd
commit
9b6275640d
2 changed files with 7 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ class CommentAnything < ActiveRecord::Migration
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
rename_column :comments, :commentable_id, :post_id
|
rename_column :comments, :commentable_id, :post_id
|
||||||
add_foreign_key :comments, :posts
|
add_foreign_key :comments, :posts, :dependent => :delete
|
||||||
add_index :comments, :post_id
|
add_index :comments, :post_id
|
||||||
|
|
||||||
remove_column :comments, :commentable_type
|
remove_column :comments, :commentable_type
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ class ShareAnything < ActiveRecord::Migration
|
||||||
t.rename :shareable_id, :post_id
|
t.rename :shareable_id, :post_id
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index :post_visibilities, [:post_id, :hidden, :contact_id]
|
add_index :post_visibilities, [:post_id, :hidden, :contact_id], :unique => true
|
||||||
add_index :post_visibilities, [:contact_id, :post_id]
|
add_index :post_visibilities, [:contact_id, :post_id], :unique => true
|
||||||
add_foreign_key :post_visibilities, :posts
|
add_foreign_key :post_visibilities, :posts, :dependent => :delete
|
||||||
|
|
||||||
|
|
||||||
remove_index :aspect_visibilities, [:shareable_id, :shareable_type]
|
remove_index :aspect_visibilities, [:shareable_id, :shareable_type]
|
||||||
|
|
@ -52,7 +52,8 @@ class ShareAnything < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index :aspect_visibilities, :post_id
|
add_index :aspect_visibilities, :post_id
|
||||||
add_index :aspect_visibilities, [:post_id, :aspect_id]
|
add_index :aspect_visibilities, [:post_id, :aspect_id], :unique => true
|
||||||
add_foreign_key :aspect_visibilities, :posts
|
add_foreign_key :aspect_visibilities, :posts, :dependent => :delete
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue