Skip to content

[BUG] Donation Model manual field update #1848

@nadiakane26

Description

@nadiakane26

In the donation model, manual is a boolean and should not accept null values.

Description

The manual field in the donation model is defined as a boolean type, which should only accept true or false values. However, the field is currently accepting null values, which violates the expected boolean constraint and can lead to unexpected behavior in queries and business logic that rely on this field having a definite true/false state.

Expected Behavior

  • The manual field should only accept boolean values: true or false
  • Attempting to insert or update a donation record with a null value for manual should either:
    • Raise a validation error, or
    • Default to a specified boolean value (e.g., false)
  • Database schema should enforce NOT NULL constraint on this column

Actual Behavior

  • The manual field accepts null values without raising an error
  • Records can be created or updated with manual = null
  • Queries checking for manual = true or manual = false may miss records where manual is null

Possible Fix

Add a NOT NULL constraint to the database column:

   change_column_null :donations, :manual, false, false

Steps to Reproduce

Context

Your Environment

  • Ruby version:
  • Server type and version:
  • Operating System and version:
  • Link to your project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions