Clean up the /scripts directory

Not removing anything, just organizing scripts into subdirectories to
make it a bit more readable.
This commit is contained in:
Mike Dalessio
2025-07-21 09:07:15 -04:00
parent f4ad46fe29
commit db6b700da8
18 changed files with 0 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
ApplicationRecord.with_each_tenant do |tenant|
User.find_each do |user|
search_queries = Set.new
to_delete = []
user.search_queries.find_each do |search_query|
if search_queries.include?(search_query.terms)
to_delete << search_query
end
search_queries << search_query.terms
end
to_delete.each(&:destroy)
end
end
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
ApplicationRecord.with_each_tenant do |tenant|
Account.find_each do |account|
tags_grouped_by_title = account.tags.group_by { |tag| tag.title.downcase }
tags_grouped_by_title.each do |title, tags|
if tags.length > 1
to_keep, to_merge = tags.first, tags[1..]
to_merge.each do |tag_to_merge|
tag_to_merge.cards.each do |card|
to_keep.cards << card unless to_keep.cards.include?(card)
end
tag_to_merge.destroy
end
end
end
end
end