Skip to content

Commit

Permalink
Don't set a default upload filename
Browse files Browse the repository at this point in the history
We don't need a default on this field as it'll be set when it's created.
  • Loading branch information
thomasleese committed Apr 10, 2024
1 parent ee78795 commit 6809e82
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/models/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Table name: uploads
#
# id :bigint not null, primary key
# filename :string default(""), not null
# filename :string not null
# malware_scan_result :string default("pending"), not null
# translation :boolean not null
# created_at :datetime not null
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20240410151207_change_upload_filename_default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeUploadFilenameDefault < ActiveRecord::Migration[7.1]
def change
change_column_default :uploads, :filename, from: "", to: nil
end
end
4 changes: 2 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions lib/tasks/uploads.rake

This file was deleted.

2 changes: 1 addition & 1 deletion spec/factories/uploads.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Table name: uploads
#
# id :bigint not null, primary key
# filename :string default(""), not null
# filename :string not null
# malware_scan_result :string default("pending"), not null
# translation :boolean not null
# created_at :datetime not null
Expand Down
Binary file removed spec/fixtures/files/translation_upload.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/models/upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Table name: uploads
#
# id :bigint not null, primary key
# filename :string default(""), not null
# filename :string not null
# malware_scan_result :string default("pending"), not null
# translation :boolean not null
# created_at :datetime not null
Expand Down

0 comments on commit 6809e82

Please sign in to comment.