Skip to content
Snippets Groups Projects
Unverified Commit 7fa3cb45 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Add loose foreign key for Terraform state versions

Changelog: changed
parent 0c2bda9a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,7 +59,7 @@ class Build < Ci::Processable
has_one :runner_session, class_name: 'Ci::BuildRunnerSession', validate: true, inverse_of: :build
has_one :trace_metadata, class_name: 'Ci::BuildTraceMetadata', inverse_of: :build
 
has_many :terraform_state_versions, class_name: 'Terraform::StateVersion', dependent: :nullify, inverse_of: :build, foreign_key: :ci_build_id # rubocop:disable Cop/ActiveRecordDependent
has_many :terraform_state_versions, class_name: 'Terraform::StateVersion', inverse_of: :build, foreign_key: :ci_build_id
 
accepts_nested_attributes_for :runner_session, update_only: true
accepts_nested_attributes_for :job_variables
Loading
Loading
Loading
Loading
@@ -41,3 +41,7 @@ pages_deployments:
- table: ci_builds
column: ci_build_id
on_delete: async_nullify
terraform_state_versions:
- table: ci_builds
column: ci_build_id
on_delete: async_nullify
Loading
Loading
@@ -81,7 +81,6 @@
subscriptions: %w[user_id subscribable_id],
suggestions: %w[commit_id],
taggings: %w[tag_id taggable_id tagger_id],
terraform_state_versions: %w[ci_build_id],
timelogs: %w[user_id],
todos: %w[target_id commit_id],
uploads: %w[model_id],
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@
it { is_expected.to have_one(:deployment) }
it { is_expected.to have_one(:runner_session) }
it { is_expected.to have_one(:trace_metadata) }
it { is_expected.to have_many(:terraform_state_versions).dependent(:nullify).inverse_of(:build) }
it { is_expected.to have_many(:terraform_state_versions).inverse_of(:build) }
 
it { is_expected.to validate_presence_of(:ref) }
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment