Files
fizzy/script/migrations/migrate_to_new_cards_url_scheme.rb
T
Mike Dalessio db6b700da8 Clean up the /scripts directory
Not removing anything, just organizing scripts into subdirectories to
make it a bit more readable.
2025-07-21 09:07:15 -04:00

18 lines
387 B
Ruby
Executable File

#!/usr/bin/env ruby
require_relative "../config/environment"
def replace_url(string)
string.gsub(%r{/buckets/(\d+)/bubbles/(\d+)}) do
"/collections/#{$1}/cards/#{$2}"
end
end
ApplicationRecord.with_each_tenant do |tenant|
Account.find_each do |account|
Comment.find_each do |comment|
comment.update!(body: replace_url(comment.body.content.to_s))
end
end
end