Sha256: af326fa38ea24370f467cab47d25cd43a9e8631a69c0ba72e0857165a1dc34c1
Contents?: true
Size: 849 Bytes
Versions: 14
Compression:
Stored size: 849 Bytes
Contents
# -*- encoding : utf-8 -*- class UpdateFileHistory < Card::CoreMigration def up Card.search(type: [:in, 'file', 'image']).each do |card| card.actions.each do |action| if (content_change = action.change_for(:db_content).first) original_filename, file_type, action_id, mod = content_change.value.split("\n") if file_type.present? && action_id.present? value = if mod.present? ":#{card.codename}/#{mod}#{::File.extname(original_filename)}" else "~#{card.id}/#{action_id}#{::File.extname(original_filename)}" end content_change.update_attributes! value: value end end end end Card.search( right: { codename: 'machine_output' } ).each do |card| card.delete! end end end
Version data entries
14 entries across 14 versions & 1 rubygems