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

Add option to use BigInt in autoincrement idField #7188

Merged
merged 10 commits into from
Jun 24, 2022

Conversation

MurzNN
Copy link
Contributor

@MurzNN MurzNN commented Jan 12, 2022

Now for autoincrement idField only Integer field type is used, which sometimes is not enough.

In this PR I've implemented an option "useBigInt" in idField configuration, that switches to use BigInt as idField in database. Here is an example how to enable this feature:

    db: {
      idField: {
        kind: 'autoincrement',
        useBigInt: true,
      }
    }

Related discussion: #6969

@vercel
Copy link

vercel bot commented Jan 12, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/8yuTCNpCzaTZTQz9iLbSCZLzf3Z5
✅ Preview: https://keystone-next-docs-git-fork-murznn-idfield-bigint-keystonejs.vercel.app

@vercel vercel bot temporarily deployed to Preview January 12, 2022 12:38 Inactive
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 12, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d4f4661:

Sandbox Source
@keystone-6/sandbox Configuration

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2022

🦋 Changeset detected

Latest commit: d4f4661

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@keystone-6/core Minor
@keystone-6/auth Major
@keystone-6/cloudinary Major
@keystone-6/fields-document Major
@keystone-6/session-store-redis Major
@keystone-6/example-auth Patch
@keystone-6/examples-app-basic Patch
@keystone-6/example-ecommerce Patch
@keystone-6/example-graphql-api-endpoint Patch
@keystone-6/example-roles Patch
@keystone-6/example-testing Patch
@keystone-6/example-with-auth Patch
@keystone-6/sandbox Patch
@keystone-6/website Patch
@keystone-6/example-document-field Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel vercel bot temporarily deployed to Preview January 13, 2022 06:58 Inactive
@vercel vercel bot temporarily deployed to Preview January 13, 2022 08:03 Inactive
@vercel vercel bot temporarily deployed to Preview January 13, 2022 08:07 Inactive
@vercel vercel bot temporarily deployed to Preview January 13, 2022 08:11 Inactive
@dcousens
Copy link
Member

dcousens commented Jun 1, 2022

Awesome work on this @MurzNN!
We haven't forgotten about this, we simply took a while to come around the mountain.

Thinking about it, I think we would want to add a db.idField.type as the discriminating factor instead of useBigInt.

For example

db: {
  idField: {
    kind: 'autoincrement',
    type: 'Int' | 'BigInt' // the underlying Prisma type, the default is 'Int' when `kind: 'autoincrement'`
  }
}

This will then be aligned with other advanced changes we intend to add, for example with our other work

@vercel
Copy link

vercel bot commented Jun 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Jun 24, 2022 at 3:25AM (UTC)

@vercel vercel bot temporarily deployed to Preview June 14, 2022 01:09 Inactive
@vercel vercel bot temporarily deployed to Preview June 14, 2022 04:56 Inactive
@MurzNN
Copy link
Contributor Author

MurzNN commented Jun 14, 2022

@dcousens yeah, adding type will simplify the whole construction, but will require more changes in core, but seems it almost implemented already, thanks!

@vercel vercel bot temporarily deployed to Preview June 24, 2022 01:32 Inactive
@vercel vercel bot temporarily deployed to Preview June 24, 2022 03:25 Inactive
@emmatown emmatown merged commit 7f83b43 into keystonejs:main Jun 24, 2022
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

Successfully merging this pull request may close these issues.

4 participants