Wrong file structure on migrate #1003
This commit is contained in:
parent
f2e161c179
commit
e4719ea5e6
@ -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)
|
# Not sure if this is the right place to do this, as its file manipulation, not database (strictly)
|
||||||
say 'Completing one-time file migration ...'
|
say 'Completing one-time file migration ...'
|
||||||
begin
|
begin
|
||||||
DmsfFileRevision.visible.find_each do |rev|
|
DmsfFileRevision.find_each do |rev|
|
||||||
next unless rev.project
|
next unless rev.project
|
||||||
existing = DmsfFile.storage_path.join rev.disk_filename
|
existing = DmsfFile.storage_path.join rev.disk_filename
|
||||||
new_path = rev.disk_file(false)
|
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)
|
# Not sure if this is the right place to do this, as its file manipulation, not database (stricly)
|
||||||
begin
|
begin
|
||||||
say 'restoring old file-structure'
|
say 'restoring old file-structure'
|
||||||
DmsfFileRevision.visible.find_each do |rev|
|
DmsfFileRevision.find_each do |rev|
|
||||||
next unless rev.project
|
next unless rev.project
|
||||||
project = rev.project.identifier.gsub(/[^\w\.\-]/, '_')
|
project = rev.project.identifier.gsub(/[^\w\.\-]/, '_')
|
||||||
existing = DmsfFile.storage_path.join("p_#{project}/#{rev.disk_filename}")
|
existing = DmsfFile.storage_path.join("p_#{project}/#{rev.disk_filename}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user