Skip to content

Tables that relate to themselves #33

Description

@mitswan

I have noticed tables that reference themselves will only work one way with this plugin.

In the example scenario, you can nested insert Child -> Parent OR Parent -> Child

create table app.parent (
  id serial primary key,
  name text not null
);

create table app.child (
  id serial primary key,
  parent_id integer,
  name text not null,
  constraint child_parent_fkey foreign key (parent_id)
    references app.parent (id)
);

But if you make it a single person table it will only let you nested insert Child -> Parent

create table app.person (
  id serial primary key,
  parent_id integer,
  name text not null,
  constraint person_parent_fkey foreign key (parent_id)
    references app.person(id)
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions