allow to make checkboxes required
This commit is contained in:
@@ -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
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user