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

In v1.2, about 'unique' tag option in embedded structures #981

Open
liut opened this issue Apr 23, 2024 · 1 comment
Open

In v1.2, about 'unique' tag option in embedded structures #981

liut opened this issue Apr 23, 2024 · 1 comment

Comments

@liut
Copy link

liut commented Apr 23, 2024

After updated to v1.2.1 today, I noticed that my unit tests which used to pass are now failing. It seems like the unique tag option in nested structures has become ineffective, and this issue is present in v1.2.0 as well.

My Go version is v1.22.0, with PostgreSQL 15, and tested in macOS 14.

More detail in https://github.com/cupogo/andvari/blob/main/stores/pgx/z0_main_test.go

type Clause struct {
	comm.BaseModel `bun:"table:cms_clause,alias:c" json:"-"`

	comm.DefaultModel

	ClauseBasic
	comm.MetaField
}

type ClauseBasic struct {
	Slug  string   `bun:"slug,notnull,type:name,unique" json:"slug" `
	Text  string   `bun:"text,notnull,type:text" form:"text" json:"text" `
	Cates []string `bun:"cates,notnull,type:jsonb" form:"cats" json:"cats" `
}

WX20240423-192758@2x

I've searched through the most recent change history and still couldn't pinpoint the specific reason.

@liut liut changed the title It seems that the 'unique' tag option is being ignored in embedded structures at 1.2.0 and 1.2.1. About 'unique' tag option in embedded structures Apr 23, 2024
@liut liut changed the title About 'unique' tag option in embedded structures About 'unique' tag option in embedded structures at v1.2 Apr 23, 2024
@liut liut changed the title About 'unique' tag option in embedded structures at v1.2 In v1.2, about 'unique' tag option in embedded structures Apr 23, 2024
@dnaeon
Copy link

dnaeon commented May 21, 2024

Seeing a similar behaviour in v1.2.1.

Any workarounds or an expected fix about this one? Thanks!

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

No branches or pull requests

2 participants