diff --git a/db/migrate/20230206203117_migrate_filetype_extensions_not_nil.rb b/db/migrate/20230206203117_migrate_filetype_extensions_not_nil.rb new file mode 100644 index 00000000..485d5542 --- /dev/null +++ b/db/migrate/20230206203117_migrate_filetype_extensions_not_nil.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index de6e7ea5..79780f02 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"