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

Postgresql text[] arrays not supported for array or type struct tags #889

Closed
genslein opened this issue Sep 6, 2023 · 1 comment
Closed

Comments

@genslein
Copy link

genslein commented Sep 6, 2023

I am trying to migrate an existing Postgresql database table that uses a field in Postgresql as text[]. However when using the Bun.BaseModel and tags this does defaults to either bytea, __varchar, or __text in the Migration of the table.

I've traced this back to this mapping here: https://github.com/uptrace/bun/blob/master/schema/sqltype.go#L45

I've tried the following to get the generation correct but bun seems to only want to recognize usage from varchar. Any way this can be supported properly for Postgresql Data types in the dialect?

https://github.com/uptrace/bun/blob/master/dialect/pgdialect/sqltype.go#L32

Tags []string `bun:",array"`
...
Tags []string `bun:"type:text[]"`
...
Tags []string `bun:",varchar[]"`
@genslein
Copy link
Author

image
nvm DBeaver was acting strange with the typing

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

1 participant