Skip to content

Commit 8829687

Browse files
committed
Add comments
1 parent da4bc37 commit 8829687

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

db/migrate/20250930215317_add_two_terms.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Migration to add "Digital" and "Drawing" terms to the "Medium" facet.
12
class AddTwoTerms < ActiveRecord::Migration[7.0]
23
def up
34
facet = Facet.find_by!(name: "Medium")

db/migrate/20250930220140_add_three_ordered_terms.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
# Migration summary:
2+
# After running `up`, the "Decade" facet will have terms:
3+
# - "2000-2009" (ord: 11)
4+
# - "2010-2019" (ord: 12)
5+
# - "After 2020" (ord: 13)
6+
# - "No Date" (ord: 14)
7+
# - "After 1999" (ord: 15, to be removed after updating items_terms)
8+
# After running `down`, the "Decade" facet will have:
9+
# - "No Date" (ord: 12)
10+
# - "After 1999" (ord: 11)
11+
# - The three new terms will be deleted.
12+
113
class AddThreeOrderedTerms < ActiveRecord::Migration[7.0]
214
def up
315
facet = Facet.find_by!(name: "Decade")
4-
5-
# Add and remove terms from facet "Decade", and reorder them.
6-
# The term "After 1999" is no longer needed and will be removed
7-
# when all items_terms have been updated
816
term = Term.find_by!(facet: facet, value: "After 1999")
17+
# NOTE: Ensure all related items_terms records are updated before removing "After 1999" to prevent orphaned references.
918
term.update!(ord: 15)
1019
term = Term.find_by!(facet: facet, value: "No Date")
1120
term.update!(ord: 14)

0 commit comments

Comments
 (0)