Skip to content

postgres arrays now generated as scalars in models #2605

@josharian

Description

@josharian

Version

1.20.0

What happened?

In v1.19.x, our model looked like:

type Bonus struct {
	ID              uuid.UUID
        // snip
	Employees       []int32
}

Generated with v.1.20.0, it is now:

type Bonus struct {
	ID              uuid.UUID
        // snip
	Employees       int32
}

The slice for Employees has been lost.

Bisected to 3c9ef73 (cc @colli173)

# \d bonus;
                                               Table "public.bonus"
      Column       |              Type              | Collation | Nullable |               Default                
-------------------+--------------------------------+-----------+----------+--------------------------------------
 id                | uuid                           |           | not null | gen_random_uuid()
-- snip
 employees         | integer[]                      |           | not null | '{}'::integer[]

This blocks us from upgrading to v1.20.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions