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

fix postgres idType config not honoured everywhere. #8130

Draft
wants to merge 1 commit into
base: beta
Choose a base branch
from

Conversation

Sam-Apostel
Copy link

Description

I initially reported on "Internal error: error: type "serial" does not exist" when setting up payload 3 beta 99 with a posgres connection to xata.io in this discussion.

Later I noticed that the payload idType option for postgres was not respected for secondary tables like payload_preferences_rels. This PR patches this.

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes
  • I have made corresponding changes to the documentation

@r1tsuu
Copy link
Member

r1tsuu commented Sep 9, 2024

I believe this would be a breaking change, you can't really simply migrate a table from numeric ID to UUID (If you already have idType: 'uuid' in the config) without writing a migration script

@Sam-Apostel
Copy link
Author

@r1tsuu Thanks for your comment.

Full disclosure, I barely know anything about this project. Trying to set it up the first time made me run into this issue and I opened this PR early (in draft) to be able to get some feedback. The PR is not tested, I haven't added test cases and haven't documented the changes.

Any hints on how I can make this not a breaking change and accepted before v3 gets out of beta?

Simplest solution for my problem would be to abandon trying to fix idType='uuid' and invent a third idType, in the discussion @DanRibbens suggested adding identityColumn. Implementation would be very similar to the changes from this PR but with a separate and new function in order to not cause any breaking changes to uuid as an idType.

Relevant drizzle code that would replace serial: integer("id").primaryKey().generatedAlwaysAsIdentity().

Other option is to write a complex migration script, which I am currently not qualified to do.

What is the stance of the maintainers on this?

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.

2 participants