2019-09-25 05:06:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ProjectPagesMetadatum < ApplicationRecord
|
2021-01-27 07:09:01 -05:00
|
|
|
extend SuppressCompositePrimaryKeyWarning
|
|
|
|
|
2020-12-23 01:10:22 -05:00
|
|
|
include EachBatch
|
|
|
|
|
2019-09-25 05:06:04 -04:00
|
|
|
self.primary_key = :project_id
|
|
|
|
|
|
|
|
belongs_to :project, inverse_of: :pages_metadatum
|
2020-08-31 14:10:43 -04:00
|
|
|
belongs_to :artifacts_archive, class_name: 'Ci::JobArtifact'
|
2020-10-12 14:08:31 -04:00
|
|
|
belongs_to :pages_deployment
|
2019-09-25 05:06:04 -04:00
|
|
|
|
|
|
|
scope :deployed, -> { where(deployed: true) }
|
2020-12-23 01:10:22 -05:00
|
|
|
scope :only_on_legacy_storage, -> { deployed.where(pages_deployment: nil) }
|
2021-01-26 10:08:58 -05:00
|
|
|
scope :with_project_route_and_deployment, -> { preload(:pages_deployment, project: [:namespace, :route]) }
|
2019-09-25 05:06:04 -04:00
|
|
|
end
|