-
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
Model with existing record but no version does not create a version on save() #94
Comments
Hi @JurjenRoels – according to this method, versions are only saved on initial creation and updates. But you're saving without making any modifications to the model. I've also missed that functionality when adding this library to models that didn't have it before with a populated database. One thing you could do is recreate all models from scratch with existing data, but I know that's not the best option. You also need to ensure the fields you update aren't included in the $dontVersionFields property of your model. I hope this helps. |
Hi, I think I will make a generic function that I can add to a handler I call on every create or update of records. It will verify if there is a currentversion and otherwise store a first one. Hopefully this will be added to the package oneday. Regards |
Sounds good! Feel free to add this method to the original class as a pull request, or at least share your workaround for others who run into the same issue. Thanks! |
Hi, we have build a whole system around models. My solution will be specific to the solution. I will post it here anyway. It could be added to a save function or an event. |
|
Hi,
I have a database with existing records and we add the VersionableTrait.
I would expect to get a version if we save an existing record?
However I get this with tinker:
DD of relevant information on record:
+exists: true
+wasRecentlyCreated: false
-updating: true
-versionableDirtyData: []
-reason: null
#versioningEnabled: true
How can I create a version on this record
The text was updated successfully, but these errors were encountered: