framework icon indicating copy to clipboard operation
framework copied to clipboard

Feature Proposal: revision history

Open ShawnMcCool opened this issue 13 years ago • 15 comments

So, I've been thinking about @taylorotwell's approach of removing the painful aspects of development through the framework and I am working on this problem and thought that it might be relevant.

I have content that has to have revision history. I can't lose old versions. In addition, I need to be able to pull a draft version and a published version. These also need to maintain native Eloquent relationships.

I'd personally like to see these problems resolved within the framework, like soft-deletes.

I believe that it might be ubiquitous enough a need and might require specific enough an implementation to Eloquent to warrant not just being a package.

In addition, I think that (like soft-deletes, migrations, unit-testing, etc) if this is easy to implement within the framework then more people would use it when the opportunity arose.

ShawnMcCool avatar Jun 20 '13 05:06 ShawnMcCool

It's definitely something that would come in very handy for a lot of situations.

There are some packages out there already that offer some of the functionality that you're suggesting that may be worth checking out. https://github.com/VentureCraft/revisionable extends Eloquent for example.

There was a blog post I read a while back about achieving a similar thing, but I can't manage to find it. I guess it shows that there is definitely a desire for it in the community at least.

The fact that Laravel already provides solf-deletes suggests to me that this may be a feature that isn't out of the scope of being included in the framework itself.

I like it.

danwall avatar Jun 20 '13 05:06 danwall

I think it's a good idea too :+1:

loic-sharma avatar Jun 20 '13 05:06 loic-sharma

I like it!

ipalaus avatar Jun 20 '13 06:06 ipalaus

Certainly a feature I'd use.

joelcox avatar Jun 20 '13 06:06 joelcox

At the company where I work we have been building a feature like this but for very narrow application, I wish something like this was built in though, it would've saved us hours upon hours.

What would this involve? something like Git inside of the DB (that would only record the differences) or something that would blindly copy the whole content from row to row?

msurguy avatar Jun 20 '13 08:06 msurguy

+1 from me, definitely very useful

DanSmith70 avatar Jun 20 '13 08:06 DanSmith70

:+1: from me. This is a often needed use-case. We are also currently using the revisionable package from VentureCraft.

stefanneubig avatar Jun 20 '13 10:06 stefanneubig

+1, definitely.

madbonkey avatar Jun 20 '13 12:06 madbonkey

I second msurguy's curiosity about implementation. Back when I had to use Joomla for a few client sites, we utilized a third-party extension called "Versions" that kept simple revisions of the content. The interface was kludgy (it just listed all of the previous versions as links, and if you clicked them it'd apply that version to your article content). The architecture was more so (rather than soft-deleting versions of the content it actually just stored complete versions of the old content in a new table). Ideally I think it'd be more interesting to store diffs when they're made, but I don't know Laravel well enough to say whether that's a sound architectural decision given the way the data model works. If nothing else I'd love to see implementation of it in-framework if for no other reason than to see how that's approached philosophically from the Eloquent perspective.

natedsaint avatar Jun 20 '13 12:06 natedsaint

Definitely on board for that.

justin-schroeder avatar Jun 20 '13 13:06 justin-schroeder

another +1

nbourguig avatar Jun 20 '13 18:06 nbourguig

You know part of me is toying with the idea of this being a trait. Has anyone looked into doing something like that? Perhaps as a community package?

taylorotwell avatar Aug 01 '13 13:08 taylorotwell

I just wanted to add this here. Someone made something relevant for Laravel 3. https://github.com/Aboalarm/Versions-for-Laravel

ShawnMcCool avatar Aug 01 '13 13:08 ShawnMcCool

I'm currently working on version control, but I'm doing it within the database. I would love reversion with laravel. But on the other hand it made has a better place in database, doesn't it? This way all the data logic is in one place.

Thomasdezeeuw avatar Aug 01 '13 13:08 Thomasdezeeuw

Will leave this up to package land.

taylorotwell avatar Nov 27 '13 17:11 taylorotwell