From c08a52e5025a19448e449dbe7df41317ad7d1ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Mon, 12 Jun 2023 16:01:26 +0200 Subject: [PATCH] DEV: Clean up old polls data from custom fields In early 2015, the poll plugin was writing its data to custom fields on the post containing the poll. It was later changed to have dedicated SQL tables and the polls were migrated but we forgot to clean the existing data. --- ...4421_remove_old_polls_data_from_custom_fields.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/poll/db/post_migrate/20230612134421_remove_old_polls_data_from_custom_fields.rb diff --git a/plugins/poll/db/post_migrate/20230612134421_remove_old_polls_data_from_custom_fields.rb b/plugins/poll/db/post_migrate/20230612134421_remove_old_polls_data_from_custom_fields.rb new file mode 100644 index 00000000000..3df78a4bd67 --- /dev/null +++ b/plugins/poll/db/post_migrate/20230612134421_remove_old_polls_data_from_custom_fields.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveOldPollsDataFromCustomFields < ActiveRecord::Migration[7.0] + def up + execute <<~SQL + DELETE FROM post_custom_fields + WHERE name LIKE 'polls%' + SQL + end + + def down + end +end