diff --git a/db/migrate/20210212095543_add_salt_to_decidim_forms_questionnaires.decidim_forms.rb b/db/migrate/20210212095543_add_salt_to_decidim_forms_questionnaires.decidim_forms.rb index 9af15d62e..beb02fe42 100644 --- a/db/migrate/20210212095543_add_salt_to_decidim_forms_questionnaires.decidim_forms.rb +++ b/db/migrate/20210212095543_add_salt_to_decidim_forms_questionnaires.decidim_forms.rb @@ -7,11 +7,14 @@ class Questionnaire < ApplicationRecord end def change + begin add_column :decidim_forms_questionnaires, :salt, :string Questionnaire.find_each do |questionnaire| questionnaire.salt = Decidim::Tokenizer.random_salt questionnaire.save! end + rescue ActiveRecord::StatementInvalid + end end end diff --git a/db/migrate/20210212095544_add_salt_to_decidim_meetings.decidim_meetings.rb b/db/migrate/20210212095544_add_salt_to_decidim_meetings.decidim_meetings.rb index d71504028..d537078ca 100644 --- a/db/migrate/20210212095544_add_salt_to_decidim_meetings.decidim_meetings.rb +++ b/db/migrate/20210212095544_add_salt_to_decidim_meetings.decidim_meetings.rb @@ -3,7 +3,7 @@ class AddSaltToDecidimMeetings < ActiveRecord::Migration[5.2] def change - add_column :decidim_meetings_meetings, :salt, :string + add_column :decidim_meetings_meetings, :salt, :string rescue ActiveRecord::StatementInvalid # we leave old entries empty to maintain the old pad reference end end