statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 71 forks source link

Revisions will not work after upgrading to Statamic v4.41.0 #229

Closed helloiamlukas closed 5 months ago

helloiamlukas commented 5 months ago

Statamic v4.41.0 introduced the following bugfix: https://github.com/statamic/cms/pull/9190 Unfortunately this breaks the revision functionality when using the eloquent driver.

Revisions are now loaded via the id attribute: https://github.com/statamic/cms/pull/9190/commits/8c3275a97c22a9a6bfe58d076cc64435d8c2e7fd

This attribute is not saved when using the eloquent driver: https://github.com/statamic/eloquent-driver/blob/6eccbb6d477df3de1759bd3a70a0fdc85e2ee9a8/src/Revisions/Revision.php#L53

@ryanmitchell What's the reason for this? Can we add the id to the attributes without any further sideeffects?

ryanmitchell commented 5 months ago

I've opened https://github.com/statamic/eloquent-driver/pull/230 to start storing id again. Im not sure why we weren't in the first place.

Unfortunately due to how the change has been made in core any old revisions will now be broken.

helloiamlukas commented 5 months ago

Great, thank you! :)

Unfortunately due to how the change has been made in core any old revisions will now be broken.

What do you think about making a migration/command, that will extract the id from the key and add it to the attributes?

ryanmitchell commented 5 months ago

If you have time to work on it I’d happily review that.

helloiamlukas commented 5 months ago

Done! https://github.com/statamic/eloquent-driver/pull/231