Is it possible to update the primary key?

Although many frames provide a standard where the primary key is auto-incremental. Our project has been in need of having a primary key of type string and with the possibility of being modified.

We have created the corresponding migration and controller. The store method allows us to place a custom key, however the update method does not modify the primary key.

1 Like

Yes, you can but without the Lucid ORM and under the condition the primary key must not be auto incrementing.

1 Like

With the query builder?

Yes, you can update it only with Query Builder

1 Like

Thank you very much, I had forgotten about the query builder :innocent:

I said you can not do it with Lucid because I had experienced that and spent a long time on it and I found out, from the source code of AdonisJs itself, that we can not do it, as simple as that. But with Query Builder I succeeded to update the primary key.

1 Like