mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							523 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							523 B
						
					
					
				| # 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
 |