Commit 04568393 authored by Giorgenes Gelatti's avatar Giorgenes Gelatti Committed by Toon Claes

Adds sha256 to package files

Adds sha256 to files as some packages require it
(for example the upcoming PyPi).
parent dd715e81
# frozen_string_literal: true
class AddsSha256ToPackageFiles < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :packages_package_files, :file_sha256, :binary
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_03_16_111759) do ActiveRecord::Schema.define(version: 2020_03_18_152134) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm" enable_extension "pg_trgm"
...@@ -3057,6 +3057,7 @@ ActiveRecord::Schema.define(version: 2020_03_16_111759) do ...@@ -3057,6 +3057,7 @@ ActiveRecord::Schema.define(version: 2020_03_16_111759) do
t.binary "file_sha1" t.binary "file_sha1"
t.string "file_name", null: false t.string "file_name", null: false
t.text "file", null: false t.text "file", null: false
t.binary "file_sha256"
t.index ["package_id", "file_name"], name: "index_packages_package_files_on_package_id_and_file_name" t.index ["package_id", "file_name"], name: "index_packages_package_files_on_package_id_and_file_name"
end end
......
...@@ -10,11 +10,12 @@ module Packages ...@@ -10,11 +10,12 @@ module Packages
def execute def execute
package.package_files.create!( package.package_files.create!(
file: params[:file], file: params[:file],
size: params[:size], size: params[:size],
file_name: params[:file_name], file_name: params[:file_name],
file_sha1: params[:file_sha1], file_sha1: params[:file_sha1],
file_md5: params[:file_md5] file_sha256: params[:file_sha256],
file_md5: params[:file_md5]
) )
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment