Skip to content

Commit

Permalink
Add empty WHN markdown field and update existing live forms
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBiddle committed Nov 17, 2023
1 parent 8614f9c commit bb55502
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class AddWhatHappensNextMarkdownToForms < ActiveRecord::Migration[7.0]
def change
add_column :forms, :what_happens_next_markdown, :text

reversible do |direction|
Form.find_each do |form|
if form.made_live_forms.present?
made_live_form = form.made_live_forms.last
form_blob = JSON.parse(made_live_form.json_form_blob, symbolize_names: true)

direction.up do
form_blob[:what_happens_next_markdown] = nil
end
direction.down do
form_blob.delete(:what_happens_next_markdown)
end

made_live_form.update!(json_form_blob: form_blob.to_json)
end
end
end
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb55502

Please sign in to comment.