Welcome to mirror list, hosted at ThFree Co, Russian Federation.

state_version.rb « terraform « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 19d708616fc06d3e63bfcd2f2dae2a4d3108f003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Terraform
  class StateVersion < ApplicationRecord
    include FileStoreMounter

    belongs_to :terraform_state, class_name: 'Terraform::State', optional: false
    belongs_to :created_by_user, class_name: 'User', optional: true
    belongs_to :build, class_name: 'Ci::Build', optional: true, foreign_key: :ci_build_id

    scope :ordered_by_version_desc, -> { order(version: :desc) }

    default_value_for(:file_store) { StateUploader.default_store }

    mount_file_store_uploader StateUploader

    delegate :project_id, :uuid, to: :terraform_state, allow_nil: true

    def local?
      file_store == ObjectStorage::Store::LOCAL
    end
  end
end

Terraform::StateVersion.prepend_if_ee('EE::Terraform::StateVersion')