add stable_id and stream
This commit is contained in:
parent
72077952e7
commit
8abe3fce79
6 changed files with 36 additions and 7 deletions
|
@ -221,7 +221,7 @@ class Champ < ApplicationRecord
|
|||
end
|
||||
|
||||
def clone(fork = false)
|
||||
champ_attributes = [:parent_id, :private, :row_id, :type, :type_de_champ_id]
|
||||
champ_attributes = [:parent_id, :private, :row_id, :type, :type_de_champ_id, :stable_id, :stream]
|
||||
value_attributes = fork || !private? ? [:value, :value_json, :data, :external_id] : []
|
||||
relationships = fork || !private? ? [:etablissement, :geo_areas] : []
|
||||
|
||||
|
|
|
@ -250,7 +250,9 @@ class TypeDeChamp < ApplicationRecord
|
|||
def params_for_champ
|
||||
{
|
||||
private: private?,
|
||||
type: "Champs::#{type_champ.classify}Champ"
|
||||
type: "Champs::#{type_champ.classify}Champ",
|
||||
stable_id:,
|
||||
stream: 'main'
|
||||
}
|
||||
end
|
||||
|
||||
|
|
13
app/tasks/maintenance/fill_champs_stable_id_task.rb
Normal file
13
app/tasks/maintenance/fill_champs_stable_id_task.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
class FillChampsStableIdTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
Champ.includes(:type_de_champ)
|
||||
end
|
||||
|
||||
def process(champ)
|
||||
champ.update_columns(stable_id: champ.stable_id, stream: 'main')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue