2017-08-31 00:06:56 -04:00
|
|
|
class CreatePostUploadJoinTable < ActiveRecord::Migration[4.2]
|
2013-06-12 19:43:50 -04:00
|
|
|
def change
|
2017-07-27 21:20:09 -04:00
|
|
|
create_table :posts_uploads, force: true, id: false do |t|
|
|
|
|
t.integer :post_id
|
|
|
|
t.integer :upload_id
|
|
|
|
end
|
2013-06-12 19:43:50 -04:00
|
|
|
|
2017-07-27 21:20:09 -04:00
|
|
|
add_index :posts_uploads, :post_id
|
|
|
|
add_index :posts_uploads, :upload_id
|
|
|
|
add_index :posts_uploads, [:post_id, :upload_id], unique: true
|
2013-06-12 19:43:50 -04:00
|
|
|
end
|
|
|
|
end
|