allow to make checkboxes required

This commit is contained in:
DocuSeal
2023-10-07 09:04:02 +03:00
parent 276b4f4a5f
commit 82854b8ce8
6 changed files with 50 additions and 17 deletions
@@ -0,0 +1,23 @@
# frozen_string_literal: true
class UpdateCheckboxesRequired < ActiveRecord::Migration[7.0]
class MigrationTemplate < ApplicationRecord
self.table_name = 'templates'
end
def up
MigrationTemplate.find_each do |template|
fields = JSON.parse(template.fields)
fields.each do |field|
field['required'] = false if field['type'] == 'checkbox'
end
template.update_columns(fields: fields.to_json) if JSON.parse(template.fields) != fields
end
end
def down
nil
end
end
+1 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_22_072041) do
ActiveRecord::Schema[7.0].define(version: 2023_10_07_052818) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"