FIX: S3 inventory can have duplicate etags

This commit is contained in:
Vinoth Kannan 2019-02-14 03:44:14 +05:30
parent 1045bbc35b
commit 426bd810f1
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ class S3Inventory
begin
table_name = "#{inventory_id}_inventory"
connection = ActiveRecord::Base.connection.raw_connection
connection.exec("CREATE TEMP TABLE #{table_name}(key text UNIQUE, etag text PRIMARY KEY)")
connection.exec("CREATE TEMP TABLE #{table_name}(key text UNIQUE, etag text, PRIMARY KEY(etag, key))")
connection.copy_data("COPY #{table_name} FROM STDIN CSV") do
files.each do |file|
CSV.foreach(file[:filename][0...-3], headers: false) do |row|