Skip to content

Commit

Permalink
Fix migrations after db sync
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolgual committed May 13, 2021
1 parent 3fdebf0 commit 8fb4279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8fb4279

Please sign in to comment.