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

Wrong Foreign Key AutoMigrate default value #7191

Open
devhaozi opened this issue Sep 7, 2024 · 0 comments
Open

Wrong Foreign Key AutoMigrate default value #7191

devhaozi opened this issue Sep 7, 2024 · 0 comments
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@devhaozi
Copy link

devhaozi commented Sep 7, 2024

GORM Playground Link

go-gorm/playground#758

Description

I'm using a Postgres database with primary key default values of generated by default as identity.
There are 2 issues here:

  1. If the primary key is used as a foreign key, then the foreign key field will also have a default value of generated by default as identity.
  2. The primary key type is not bigint as specified by type:.

Below is a screenshot of the playground CI running:
image

Related issues: #5222 #5534
(they were missing the playground link, so I opened this)

Expected behavior

  1. ID The ID field correctly use the type: tag, bigint type and generated by default as identity.
  2. Referenced foreign keys should not use the parent key's type: tag.
@github-actions github-actions bot added the type:with reproduction steps with reproduction steps label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
Development

No branches or pull requests

2 participants