Skip to content

Relationship data getting deleted when restoring a revision #632

@edalzell

Description

@edalzell

Description

This is a tricky one.

I have a model w/ with a HasMany relationship (updates) and I have revisions enabled. When I restore a version that has no updates, any update records are actually deleted from the DB.

Steps to reproduce

  1. Have a HasMany relationship on a model that has revisions enabled
  2. Have that field visible on the resource page
  3. Publish this version that has no relationship records.
  4. create a related model CleanShot 2024-11-20 at 15 43 55@2x
  5. Save Changes & publish this version (now the relationship exists in the db)
  6. restore first version (w/o any relationship data), and publish
  7. See that the relationship data has actually been deleted from the db.

Environment

Environment
Application Name: Zakat Foundation of America
Laravel Version: 11.30.0
PHP Version: 8.3.13
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: zakat.test
Maintenance Mode: OFF
Timezone: America/Los_Angeles
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: mysql
Logs: stack / daily
Mail: smtp
Queue: sync
Session: file

Livewire
Livewire: v3.5.12

Statamic
Addons: 13
Sites: 4 (zakat.org (EN), zakat.org (AR), zfinstitute.com (ZFI), zakat.org (TR))
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.37.0 PRO

Statamic Addons
aryehraber/statamic-captcha: 1.13.0
edalzell/forma: 3.0.1
jacksleight/statamic-bard-mutator: 2.3.1
jacksleight/statamic-distill: 0.8.0
jonassiewertsen/statamic-livewire: 3.8.1
statamic-rad-pack/runway: 7.12.0
statamic/seo-pro: 6.3.0
transformstudios/events: 5.4.3
transformstudios/front: 3.0.1
transformstudios/github: dev-main
transformstudios/neon: dev-update-simple
transformstudios/review: 5.0
transformstudios/simple: 5.6.16

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions