diff --git a/db/migrate/20250522045138_cleanup_amazon_translations.rb b/db/migrate/20250522045138_cleanup_amazon_translations.rb new file mode 100644 index 00000000..95362ce0 --- /dev/null +++ b/db/migrate/20250522045138_cleanup_amazon_translations.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class CleanupAmazonTranslations < ActiveRecord::Migration[7.2] + def up + provider = + DB.query_single("SELECT value FROM site_settings WHERE name = 'translator_provider'").first + if provider == "Amazon" + execute <<~SQL + DELETE FROM discourse_translator_post_translations + WHERE translation LIKE '{:translated_text%' + SQL + + execute <<~SQL + DELETE FROM discourse_translator_topic_translations + WHERE translation LIKE '{:translated_text%' + SQL + end + end + + def down + end +end