forked from openfoodfoundation/openfoodnetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RedundantPresenceValidationOnBelongs on some files (part VI)
- presence: true is redundant since Rails 5.0 BUT applies with new default config of belongs_to_required_by_default to true. Lots of files with belongs_to_required_by_default = false (backward compatibility). So: deleting this setting implies to adding optional: true - added 'NOT NULL' constraints so model constraints match with contraints on DB tables. - corresponding migration files to match AR Models & DB tables - rake tasks to check corrupt data (ie: NULL/nil in id fields) (previous commit) - updated the todo
- Loading branch information
Showing
4 changed files
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
db/migrate/20240529081209_require_order_and_variant_on_line_item.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class RequireOrderAndVariantOnLineItem < ActiveRecord::Migration[7.0] | ||
def change | ||
change_column_null :spree_line_items, :order_id, false | ||
change_column_null :spree_line_items, :variant_id, false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters