私密版本库的问题

dev_daiao
daiao 5 years ago
parent 89382f4658
commit 4c90d1486b

@ -43,8 +43,6 @@ class AttachmentsController < ApplicationController
local_path, digest = file_save_to_local(save_path, upload_file.tempfile, ext)
content_type = upload_file.content_type.presence || 'application/octet-stream'
container_id = upload_file.container_id.
container_tpe = upload_file.container_id
# remote_path = file_save_to_ucloud(local_path[folder.size, local_path.size], local_path, content_type)
remote_path = nil # TODO 暂时本地上传,待域名配置后方可上传至云端
@ -70,9 +68,9 @@ class AttachmentsController < ApplicationController
@attachment.author_id = current_user.id
@attachment.disk_directory = month_folder
@attachment.cloud_url = remote_path
@attachment.container_id = upload_file.container_id
@attachment.container_type = upload_file.container_type
@attachment.attachtype = upload_file.attachtype
@attachment.container_id = params[:container_id]
@attachment.container_type = params[:container_type]
@attachment.attachtype = params[:attachtype]
@attachment.save!
else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"

@ -0,0 +1,17 @@
class AddIndexForShixunSecretRepositories < ActiveRecord::Migration[5.2]
def change
shixun_ids = ShixunSecretRepository.pluck(:shixun_id).uniq
shixuns = Shixun.where(id: shixun_ids)
shixuns.find_each do |shixun|
id = shixun.shixun_secret_repository.id
shixun_secret_repositories = ShixunSecretRepository.where(shixun_id: shixun.id).where.not(id: id)
shixun_secret_repositories.destroy_all
end
remove_index :shixun_secret_repositories, :shixun_id
add_index :shixun_secret_repositories, :shixun_id, unique: true
end
end
Loading…
Cancel
Save