Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Stop using gorm.Model to disable gorm side effects #155

Merged
merged 1 commit into from
Mar 19, 2023
Merged

Commits on Mar 19, 2023

  1. Stop using gorm.Model to disable gorm side effects

    By default gorm.Model includes a number of fields extra fields
    CreatedAt/UpdatedAt and DeletedAt. Because DeletedAt is present gorm
    automatically enables soft-delete, which results in gorm not remove the
    records from the DB upon delete instead it just sets DeletedAt, and then
    hides them from further queries.
    
    As we are using db.Raw gorm doesn't hide these records and will show
    deleted records and not deleted records togther. For this reason this
    commit drops the gorm.Model and replaces it simply with the ID primary
    key that is a requirement.
    
    Note(sambetts): If we want to add CreatedAt/UpdatedAt fields in the
    future we should add them to the API model and manage them in the gorm
    driver, so that they are available to query through odata.
    Tehsmash authored and FrimIdan committed Mar 19, 2023
    Configuration menu
    Copy the full SHA
    496d80d View commit details
    Browse the repository at this point in the history