Skip to content

postgres: reform-db fails on 'unique' constraint #196

@fpawel

Description

@fpawel

General description of the problem

Reform does not generate models for tables with UNIQUE constraint in body of CREATE TABLE

Code snippets to reproduce the problem

CREATE TABLE some_table
(
  id SERIAL PRIMARY KEY NOT NULL,
  special_field   INTEGER  NOT NULL,
  UNIQUE (id, special_field)
);
>reform-db -db-driver=postgres -db-source="..." init
>reform-db: Expected single column primary key, got 2

The next code works:

CREATE TABLE some_table
(
  id SERIAL PRIMARY KEY NOT NULL,
  special_field   INTEGER  NOT NULL
);
CREATE UNIQUE INDEX pg_unique_some_table_id_special_field ON some_table (id, special_field);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions