Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Primary key not incrementing #155
Do you have any idea on why my primary key is not incrementing?
This is my model:
Here is how I try to insert:
The error message is the following:
I also tried using de DB facade and the same error is raised:
The table and sequence wasn't created using migrations, it was already created and it works properly in PL/SQL Developer.
Despite the inserts don't work, selects, updates and deletes work well.
@gabrieloliverio, setting a custom sequence is not yet fully functional. ATM, I think you need to set the id manually by getting the next value of the sequence. See https://github.com/yajra/laravel-oci8/wiki/Oracle-Sequence.
BTW, do you have your own auto-increment trigger on your table? Will dig this further when I got the chance. Thanks!
@yajra Incrementing manually the sequence and setting it to the table id worked, like you said Thanks a lot! It would be great if you put this information in your wiki ;)
Now I work with a proprietary framework and stored procedures, don't have a auto-increment trigger on my table.
This feature of auto-incrementing through custom sequences, when fully implemented, will work like the way I tried to do or it will be different? Also, your prefix_schema feature will be very welcome!
Thanks for your help!
Yes, when this is fully implemented, you don't have to manually set the
@gabrieloliverio, I just released the PR of @ChaosPower which will basically complete the custom sequence feature of the package. See https://github.com/yajra/laravel-oci8/wiki/Oracle-Sequence#incrementing-model-using-custom-sequence-available-on-v522 for example usage.
Let us know if it works for you. Thanks!