Skip to content

Name clash in tables with newest release #305

Open
@sweigert

Description

@sweigert

Hi,

I was upgrading to the latest release but I get an error in the generated code. It is related to how the variables are named in the generated models since it generated an error variable for the unique constraints which seems to follow the naming pattern <TableName>Errors.
But if you actually have a table, called device_errors it will also translate to DeviceErrors.

Here is a minimal example:

CREATE TABLE devices (
  id UUID,
  id2 UUID,
  PRIMARY KEY (id)
);

CREATE TABLE device_errors (
  id UUID,
  PRIMARY KEY (id)
);

ALTER TABLE devices ADD CONSTRAINT unique_devices UNIQUE (id, id2);

The generated code cannot compile since DeviceErrors will be defined multiple times.

Btw, I am really enjoying bob. Thanks for your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions