2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-30 23:06:56 -05:00
|
|
|
class CreatePostUploadJoinTable < ActiveRecord::Migration[4.2]
|
2013-06-12 18:43:50 -05:00
|
|
|
def change
|
2017-07-27 20:20:09 -05:00
|
|
|
create_table :posts_uploads, force: true, id: false do |t|
|
|
|
|
t.integer :post_id
|
|
|
|
t.integer :upload_id
|
|
|
|
end
|
2013-06-12 18:43:50 -05:00
|
|
|
|
2017-07-27 20:20:09 -05:00
|
|
|
add_index :posts_uploads, :post_id
|
|
|
|
add_index :posts_uploads, :upload_id
|
2023-01-09 05:59:41 -06:00
|
|
|
add_index :posts_uploads, %i[post_id upload_id], unique: true
|
2013-06-12 18:43:50 -05:00
|
|
|
end
|
|
|
|
end
|