Skip to content

Wrong Foreign Key AutoMigrate default value #7191

Description

@devhaozi

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions