Closed jotaajunior closed 3 years ago
I will suggest naming it as foreignKeyColumn
or maybe just foreignKey
?
Seems like foreignKey
is a better option
Ok, pretty much agree with everything.
Could you verify if the tests are correct? I'm not really an expert.
Maybe I could also squash the commits?
Closed and re-opened for the tests to run
Thanks for the PR 😄
Proposed changes
I'm using Adonis in one of my projects and due to internal nomenclature conflicts the
users
table actually mean a totally different thing from the originalusers
table.So, I renamed the
Users
model toAccount
and updated the config, everything work out perfectlly, but since I'm using the OAT guard, I have this in myapi_tokens
migration:I updated to this:
But since the
user_id
is hardcoded inside the package, this throws an error:Obivouslly I could do:
But I think this is missleading, as
User
exists and is a completly different entity, in my case.I do understand that this is probably not a very common issue, so I tried to make this a non-breaking-change.
Currently the
DatabaseTokenProviderConfig
looks like this:I changed to this:
Notice
foreignKey
is optional. As most of the times theforeignKey
will beuser_id
, I think that maybe we could automatically infer theforeignKey
as beinguser_id
.Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
As I said I don't think this is a relevant change at all, but since is possible to change the default "users" table maybe would also be usefull to have the ability to change the foreign key.