Skip to content

Commit a7a5a89

Browse files
committed
Update variable name
1 parent a0ca4ac commit a7a5a89

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

db/migrate/20250930230620_update_fix_term_item_relation.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class UpdateFixTermItemRelation < ActiveRecord::Migration[7.0]
22
def up
33
after_1999_id = select_value("SELECT id FROM terms WHERE value = 'After 1999'")
4-
after_2000_id = select_value("SELECT id FROM terms WHERE value = 'After 2020'")
5-
return unless after_1999_id && after_2000_id
4+
after_2020_id = select_value("SELECT id FROM terms WHERE value = 'After 2020'")
5+
return unless after_1999_id && after_2020_id
66

77
execute <<~SQL.squish
88
WITH target AS (
@@ -14,7 +14,7 @@ def up
1414
AND i.date = '[2020]'
1515
)
1616
UPDATE items_terms it
17-
SET term_id = #{after_2000_id}
17+
SET term_id = #{after_2020_id}
1818
FROM target
1919
WHERE it.item_id = target.item_id
2020
AND it.term_id = target.term_id;
@@ -23,16 +23,16 @@ def up
2323

2424
def down
2525
after_1999_id = select_value("SELECT id FROM terms WHERE value = 'After 1999'")
26-
after_2000_id = select_value("SELECT id FROM terms WHERE value = 'After 2020'")
27-
return unless after_1999_id && after_2000_id
26+
after_2020_id = select_value("SELECT id FROM terms WHERE value = 'After 2020'")
27+
return unless after_1999_id && after_2020_id
2828

2929
execute <<~SQL.squish
3030
WITH target AS (
3131
SELECT it.term_id, it.item_id
3232
FROM items i
3333
JOIN items_terms it ON i.id = it.item_id
3434
JOIN terms t ON it.term_id = t.id
35-
WHERE t.id = #{after_2000_id}
35+
WHERE t.id = #{after_2020_id}
3636
AND i.date = '[2020]'
3737
)
3838
UPDATE items_terms it

0 commit comments

Comments
 (0)