Class: Upgrade::BackfillDerivativesBase

Inherits:
FileTypeIterationJob
  • Object
show all
Defined in:
app/jobs/upgrade/backfill_derivatives_base.rb

Instance Method Summary collapse

Instance Method Details

#apply(modelfile) ⇒ Object



14
15
16
# File 'app/jobs/upgrade/backfill_derivatives_base.rb', line 14

def apply(modelfile)
  modelfile.check_derivatives!
end

#derivative ⇒ Object

Raises:

  • (NotImplementedError)


2
3
4
# File 'app/jobs/upgrade/backfill_derivatives_base.rb', line 2

def derivative
  raise NotImplementedError
end

#scope ⇒ Object



6
7
8
9
10
11
12
# File 'app/jobs/upgrade/backfill_derivatives_base.rb', line 6

def scope
  super.where(
    DatabaseDetector.is_postgres? ?
      "json_extract_path(attachment_data, 'derivatives', '#{derivative}') IS NULL" :
      "json_extract(attachment_data, '$.derivatives.#{derivative}') IS NULL"
  )
end