added migration to replace existing file_extension containing nil with ''

This commit is contained in:
Karol
2023-02-06 21:46:11 +01:00
committed by Sebastian Serth
parent 637f872f34
commit 93188ba04d
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class MigrateFiletypeExtensionsNotNil < ActiveRecord::Migration[7.0]
def change
FileType.all.find_all {|file_type| file_type.file_extension.nil? }.each do |file_type|
file_type.update file_extension: ''
end
end
end

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_01_20_185807) do
ActiveRecord::Schema[7.0].define(version: 2023_02_06_203117) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"