Wrong file structure on migrate #1003

This commit is contained in:
Karel Pičman 2019-05-02 12:39:04 +02:00
parent f2e161c179
commit e4719ea5e6

View File

@ -72,7 +72,7 @@ class Dmsf144 < ActiveRecord::Migration[4.2]
# Not sure if this is the right place to do this, as its file manipulation, not database (strictly)
say 'Completing one-time file migration ...'
begin
DmsfFileRevision.visible.find_each do |rev|
DmsfFileRevision.find_each do |rev|
next unless rev.project
existing = DmsfFile.storage_path.join rev.disk_filename
new_path = rev.disk_file(false)
@ -120,7 +120,7 @@ class Dmsf144 < ActiveRecord::Migration[4.2]
# Not sure if this is the right place to do this, as its file manipulation, not database (stricly)
begin
say 'restoring old file-structure'
DmsfFileRevision.visible.find_each do |rev|
DmsfFileRevision.find_each do |rev|
next unless rev.project
project = rev.project.identifier.gsub(/[^\w\.\-]/, '_')
existing = DmsfFile.storage_path.join("p_#{project}/#{rev.disk_filename}")