13 trait :with_history do
14 after(:create) do |relation, _evaluator|
15 (1..relation.version).each do |n|
16 create(:old_relation, :relation_id => relation.id, :version => n, :changeset => relation.changeset)
19 # For deleted relations, make sure the most recent old_relation is also deleted.
20 if relation.visible == false
21 latest = relation.old_relations.find_by(:version => relation.version)
22 latest.visible = false