Update migration
This commit is contained in:
@@ -4,13 +4,15 @@ class UpdateAliasedImplicationAntecedents < ActiveRecord::Migration
|
|||||||
TagImplication.find_each do |ti|
|
TagImplication.find_each do |ti|
|
||||||
ta = TagAlias.where("antecedent_name = ? AND status != ?", ti.antecedent_name, "pending").first
|
ta = TagAlias.where("antecedent_name = ? AND status != ?", ti.antecedent_name, "pending").first
|
||||||
if ta
|
if ta
|
||||||
|
existing_ti = TagImplication.where("antecedent_name = ? AND consequent_name = ?", ta.consequent_name, ti.consequent_name).first
|
||||||
|
existing_ti.destroy if existing_ti
|
||||||
|
|
||||||
if ta.consequent_name == ti.consequent_name
|
if ta.consequent_name == ti.consequent_name
|
||||||
ti.destroy
|
ti.destroy
|
||||||
elsif TagImplication.where("antecedent_name = ? AND consequent_name = ?", ta.consequent_name, ti.consequent_name).exists?
|
|
||||||
ti.destroy
|
|
||||||
else
|
else
|
||||||
ti.antecedent_name = ta.consequent_name
|
ti.antecedent_name = ta.consequent_name
|
||||||
ti.save
|
ti.save
|
||||||
|
ti.update_posts
|
||||||
end
|
end
|
||||||
ta.update_posts
|
ta.update_posts
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user