Skip to content

Inherited tables do not get updating after adding column to parent table #3024

Open
@eberkund

Description

@eberkund

Version

1.24.0

What happened?

I created an inherited table in Postgres and everything worked as expected.

Then I decided I needed to add a column to the parent table, but when I did this the models for the inherited tables did not get updated with the new column.

Relevant log output

No response

Database schema

CREATE TABLE traffic_sensors(
    id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    serial_number varchar(16) NOT NULL,
    sampling_rate interval NOT NULL,
    base_station_serial varchar NOT NULL
);

CREATE TABLE traffic_sensors_random(
    max integer NOT NULL,
    min integer NOT NULL
)
INHERITS (
    traffic_sensors
);

ALTER TABLE traffic_sensors
    ADD sensor_type varchar;

SQL queries

SELECT
    *
FROM
    traffic_sensors_random;

Configuration

version: "2"

sql:
- engine: "postgresql"
  queries: "sql/queries"
  schema: "sql/migrations"
  gen:
    go:
      package: "persist"
      out: "persist"
      emit_interface: true

overrides:
  go:
    overrides:
      - db_type: "pg_catalog.interval"
        engine: "postgresql"
        go_type:
          import: "github.com/jackc/pgtype"
          type: "Interval"

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