Skip to content

Commit 26cdfee

Browse files
authored
Merge pull request #371 from alphagov/add-what-happens-next-markdown-field
Add empty what happens next markdown field
2 parents 4f10b99 + cd93c71 commit 26cdfee

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class AddWhatHappensNextMarkdownToForms < ActiveRecord::Migration[7.0]
2+
def change
3+
add_column :forms, :what_happens_next_markdown, :text
4+
5+
reversible do |direction|
6+
MadeLiveForm.find_each do |made_live_form|
7+
form_blob = JSON.parse(made_live_form.json_form_blob, symbolize_names: true)
8+
9+
direction.up do
10+
form_blob[:what_happens_next_markdown] = nil
11+
end
12+
direction.down do
13+
form_blob.delete(:what_happens_next_markdown)
14+
end
15+
16+
made_live_form.update!(json_form_blob: form_blob.to_json)
17+
end
18+
end
19+
end
20+
end

db/schema.rb

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/models/form_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
"declaration_section_completed",
262262
"pages",
263263
"page_order",
264+
"what_happens_next_markdown",
264265
)
265266
end
266267
end

spec/request/api/v1/forms_controller_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
form_slug: "test-form-1",
196196
start_page: nil,
197197
what_happens_next_text: nil,
198+
what_happens_next_markdown: nil,
198199
support_email: nil,
199200
support_phone: nil,
200201
support_url: nil,

0 commit comments

Comments
 (0)