-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create the first version of a model in an existing project? #73
Comments
I don't think that's supported. You could do a minimal update to your model to force a version to be created. https://github.com/mpociot/versionable/blob/master/src/Mpociot/Versionable/VersionableTrait.php#L163 This method only runs after saving (on first creation or update) but I haven't found a way to force create a version. Seems like a good thing to add to the package. |
This works fine for me. I firstly created a new article and that first version was successfully saved. I then edited an existing article and that was also successfully saved. What you need to do is open the item or article in my case and save it with no changes, it'll save that version for you. |
Hi, @DerekBuntin, thanks for your comment! I believe @ricardogffcouto was talking about creating a version from pre-existing elements, not newly created articles/items. 🙂 |
Hi @nonoesp, yeah I also just opened an already created row, one that existed before integrating the package, opened it and then saved it successfully. |
I see. Thanks for testing then! I'll give it a try. =) |
As it seems to be a one time only function, I guess you could write a command to loop (chunk) touching all models |
Hello! I am adding versionable to an existing project, with a pre-filled database. I want the current values to be the first versions of each object. How can I accomplish that?
Thanks!
The text was updated successfully, but these errors were encountered: