Migration to migrate URLs after renaming bubbles => cards
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user