Skip to content
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

Be able to use .primary() as for unique() constraint #207

Closed
girardinsamuel opened this issue Oct 21, 2020 · 4 comments
Closed

Be able to use .primary() as for unique() constraint #207

girardinsamuel opened this issue Oct 21, 2020 · 4 comments

Comments

@girardinsamuel
Copy link
Contributor

Be able on a migration to use primary() this way:

table.increments("user_id").primary()
@josephmancuso
Copy link
Member

josephmancuso commented Oct 21, 2020

@girardinsamuel increments is special. Increments assumes that its the primary key.

increments is the same as "auto incrementing primary column" version of the table so its a bit of an all-in-one.

What we really need to to be able to specify any one of the other column types as a primary key like:

table.unsigned_integer('col').primary()

@girardinsamuel
Copy link
Contributor Author

@josephmancuso Yes that was a bad example but that's what I had in mind.
And increments was confusing me I wasn't sure about what was ran under the hood. thanks for clarifying.

I will update the PR then

@josephmancuso
Copy link
Member

ok great just making sure :)

@girardinsamuel
Copy link
Contributor Author

girardinsamuel commented Oct 21, 2020

I have updated the test in the PR, when I am using .primary() on a simple integer column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants