[openSUSE/open-build-service] 29eb3c: Enable `belongs_to_required_by_default` behaviour
Branch: refs/heads/master Home: https://github.com/openSUSE/open-build-service Commit: 29eb3c18708aee07978fa576246efc434e857fc0 https://github.com/openSUSE/open-build-service/commit/29eb3c18708aee07978fa5... Author: Lukas Krause <lkrause@suse.de> Date: 2022-01-12 (Wed, 12 Jan 2022) Changed paths: M src/api/config/application.rb Log Message: ----------- Enable `belongs_to_required_by_default` behaviour Since Rails 5.0 `belongs_to` automatically checks for the presence of the related record. We opted out this behavior in previous Rails upgrades. It's time to enable the default behavior (also since rubocop-rails 2.13 introduced a cop that checks for redundant validation to check for the presence of a record). Commit: 6844d9b926dbe3bae6b075bf1f61f0403c993556 https://github.com/openSUSE/open-build-service/commit/6844d9b926dbe3bae6b075... Author: Lukas Krause <lkrause@suse.de> Date: 2022-01-12 (Wed, 12 Jan 2022) Changed paths: M src/api/app/models/attrib.rb M src/api/app/models/comment.rb M src/api/app/models/commit_activity.rb M src/api/app/models/download_repository.rb M src/api/app/models/group_maintainer.rb M src/api/app/models/groups_user.rb M src/api/app/models/kiwi/profile.rb M src/api/app/models/notified_project.rb M src/api/app/models/path_element.rb M src/api/app/models/relationship.rb M src/api/app/models/repository.rb M src/api/app/models/repository_architecture.rb M src/api/app/models/review.rb M src/api/app/models/staging/request_exclusion.rb M src/api/app/models/staging/workflow.rb M src/api/app/models/status/report.rb M src/api/app/models/status_message.rb M src/api/app/models/status_message_acknowledgement.rb M src/api/app/models/token.rb M src/api/app/models/watched_project.rb Log Message: ----------- Remove redundant presence validations for belongs_to relations After enabling `belongs_to_required_by_default` those checks for presence are done automatically. Commit: 2216b2dcb6a54c3f196a67c443e71e0ac40628a3 https://github.com/openSUSE/open-build-service/commit/2216b2dcb6a54c3f196a67... Author: Lukas Krause <lkrause@suse.de> Date: 2022-01-12 (Wed, 12 Jan 2022) Changed paths: M src/api/app/models/attrib_default_value.rb M src/api/app/models/attrib_namespace_modifiable_by.rb M src/api/app/models/attrib_type_modifiable_by.rb M src/api/app/models/attrib_value.rb M src/api/app/models/backend_package.rb M src/api/app/models/binary_release.rb M src/api/app/models/bs_request.rb M src/api/app/models/bs_request_action.rb M src/api/app/models/bs_request_action_accept_info.rb M src/api/app/models/channel_binary.rb M src/api/app/models/channel_binary_list.rb M src/api/app/models/cloud/azure/configuration.rb M src/api/app/models/cloud/ec2/configuration.rb M src/api/app/models/cloud/user/upload_job.rb M src/api/app/models/concerns/staging_project.rb M src/api/app/models/event_subscription.rb M src/api/app/models/flag.rb M src/api/app/models/issue.rb M src/api/app/models/kiwi/description.rb M src/api/app/models/kiwi/package.rb M src/api/app/models/kiwi/package_group.rb M src/api/app/models/kiwi/preference.rb M src/api/app/models/kiwi/repository.rb M src/api/app/models/linked_project.rb M src/api/app/models/maintenance_incident.rb M src/api/app/models/notification.rb M src/api/app/models/package.rb M src/api/app/models/package_kind.rb M src/api/app/models/product_medium.rb M src/api/app/models/product_update_repository.rb M src/api/app/models/project.rb M src/api/app/models/project_log_entry.rb M src/api/app/models/review.rb M src/api/app/models/role.rb M src/api/app/models/status/check.rb M src/api/app/models/token.rb M src/api/app/models/user.rb M src/api/app/models/workflow_run.rb Log Message: ----------- Set optional flag on belongs_to relation where necessary After enabling `belongs_to_required_by_default` we have to explicitly tell rails where the associated record is optional. I set it to optional where ever it is not dissallowed on DB level with the `not_null` value or where no explicit validation for presence was set in the past. This way we keep the previous behavior and don't break any code. Commit: e2b0bf793404bab868fe5cdd3ad812c1d763d014 https://github.com/openSUSE/open-build-service/commit/e2b0bf793404bab868fe5c... Author: Lukas Krause <lkrause@suse.de> Date: 2022-01-12 (Wed, 12 Jan 2022) Changed paths: M src/api/spec/controllers/webui/download_on_demand_controller_spec.rb M src/api/spec/controllers/webui/repositories_controller_spec.rb M src/api/spec/models/bs_request_action_spec.rb M src/api/spec/models/cloud/ec2/configuration_spec.rb M src/api/spec/models/cloud/user/upload_job_spec.rb M src/api/spec/models/comment_spec.rb M src/api/spec/models/commit_activity_spec.rb M src/api/spec/models/download_repository_spec.rb M src/api/spec/models/repository_spec.rb M src/api/spec/models/review_spec.rb M src/api/spec/models/staging/workflow_spec.rb M src/api/spec/models/status/report_spec.rb M src/api/spec/models/token_spec.rb Log Message: ----------- Adapt specs to take belongs_to_required_by_default into account Commit: 52547d15ed6eec7d55865d13c1adb0624872e0ac https://github.com/openSUSE/open-build-service/commit/52547d15ed6eec7d55865d... Author: Rubhan Azeem <rubhanazeem@gmail.com> Date: 2022-01-13 (Thu, 13 Jan 2022) Changed paths: M src/api/app/models/attrib.rb M src/api/app/models/attrib_default_value.rb M src/api/app/models/attrib_namespace_modifiable_by.rb M src/api/app/models/attrib_type_modifiable_by.rb M src/api/app/models/attrib_value.rb M src/api/app/models/backend_package.rb M src/api/app/models/binary_release.rb M src/api/app/models/bs_request.rb M src/api/app/models/bs_request_action.rb M src/api/app/models/bs_request_action_accept_info.rb M src/api/app/models/channel_binary.rb M src/api/app/models/channel_binary_list.rb M src/api/app/models/cloud/azure/configuration.rb M src/api/app/models/cloud/ec2/configuration.rb M src/api/app/models/cloud/user/upload_job.rb M src/api/app/models/comment.rb M src/api/app/models/commit_activity.rb M src/api/app/models/concerns/staging_project.rb M src/api/app/models/download_repository.rb M src/api/app/models/event_subscription.rb M src/api/app/models/flag.rb M src/api/app/models/group_maintainer.rb M src/api/app/models/groups_user.rb M src/api/app/models/issue.rb M src/api/app/models/kiwi/description.rb M src/api/app/models/kiwi/package.rb M src/api/app/models/kiwi/package_group.rb M src/api/app/models/kiwi/preference.rb M src/api/app/models/kiwi/profile.rb M src/api/app/models/kiwi/repository.rb M src/api/app/models/linked_project.rb M src/api/app/models/maintenance_incident.rb M src/api/app/models/notification.rb M src/api/app/models/notified_project.rb M src/api/app/models/package.rb M src/api/app/models/package_kind.rb M src/api/app/models/path_element.rb M src/api/app/models/product_medium.rb M src/api/app/models/product_update_repository.rb M src/api/app/models/project.rb M src/api/app/models/project_log_entry.rb M src/api/app/models/relationship.rb M src/api/app/models/repository.rb M src/api/app/models/repository_architecture.rb M src/api/app/models/review.rb M src/api/app/models/role.rb M src/api/app/models/staging/request_exclusion.rb M src/api/app/models/staging/workflow.rb M src/api/app/models/status/check.rb M src/api/app/models/status/report.rb M src/api/app/models/status_message.rb M src/api/app/models/status_message_acknowledgement.rb M src/api/app/models/token.rb M src/api/app/models/user.rb M src/api/app/models/watched_project.rb M src/api/app/models/workflow_run.rb M src/api/config/application.rb M src/api/spec/controllers/webui/download_on_demand_controller_spec.rb M src/api/spec/controllers/webui/repositories_controller_spec.rb M src/api/spec/models/bs_request_action_spec.rb M src/api/spec/models/cloud/ec2/configuration_spec.rb M src/api/spec/models/cloud/user/upload_job_spec.rb M src/api/spec/models/comment_spec.rb M src/api/spec/models/commit_activity_spec.rb M src/api/spec/models/download_repository_spec.rb M src/api/spec/models/repository_spec.rb M src/api/spec/models/review_spec.rb M src/api/spec/models/staging/workflow_spec.rb M src/api/spec/models/status/report_spec.rb M src/api/spec/models/token_spec.rb Log Message: ----------- Merge pull request #12062 from krauselukas/enable_belongs_to_required_by_default Enable belongs to required by default Compare: https://github.com/openSUSE/open-build-service/compare/3b6e3cd6bedf...52547d...
participants (1)
-
Rubhan Azeem