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

sql/dialect/schema: support setting PK to serial types in postgres #2748

Merged
merged 1 commit into from Jul 13, 2022

Conversation

a8m
Copy link
Member

@a8m a8m commented Jul 13, 2022

Fixed #2744.

Users that want to use a serial type for their id field, can create one mixed-in schema (with the definition below) and embed it in all schemas.

func (MixinID) Fields() []ent.Field {
	return []ent.Field{
		field.Int("id").
			SchemaType(map[string]string{
				dialect.Postgres: postgres.TypeBigSerial,
			}),
	}
}

@a8m a8m merged commit 1c01301 into master Jul 13, 2022
@a8m a8m deleted the pgserial branch July 13, 2022 11:40
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.

[Question] Working with exists postgres array column with default value.
1 participant