From 13bc47429148af0a203272dae3a9d7c88a765f38 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 26 Sep 2026 18:59:40 +0200 Subject: [PATCH] Make old migration work with Postgres in Rails 7.2 The old where clause causes an error but only with the Postgres adapter. Fortunately, Rails now supports better syntax for such complex where clauses. --- db/migrate/114_fixes_buggy_articles_and_notes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/114_fixes_buggy_articles_and_notes.rb b/db/migrate/114_fixes_buggy_articles_and_notes.rb index 30da3f9e..d9a8352e 100644 --- a/db/migrate/114_fixes_buggy_articles_and_notes.rb +++ b/db/migrate/114_fixes_buggy_articles_and_notes.rb @@ -34,14 +34,14 @@ def set_permalink def self.up say "Fixing contents permalinks, this may take some time" - contents = Content.where("permalink is ? or permalink = ?", nil, "") + contents = Content.where(permalink: nil).or Content.where(permalink: "") contents.each do |c| c.set_permalink c.save end say "Fixes empty notes GUID" - notes = Note.where("guid is ? or guid = ?", nil, "") + notes = Note.where(guid: nil).or Note.where(guid: "") notes.each do |n| n.create_guid n.save