k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.32k stars 163 forks source link

Error when referencing itsself #593

Open uvulpos opened 3 weeks ago

uvulpos commented 3 weeks ago

What happened

I have a database with a role. A role can inherit from another role. Like for example the role chef inherits permissions from the role cook like using_knife or use_stove. But chef also have additional roles like buy_groceries. When cook gets a new role, chef should get it too. So I have a reference to itself

What you expected to happened

An arrow on the side to itself. Maybe even colorful to see its referencing to itsself. But not bothering other innocent tables

What stack trace or error message from tbls did you see?

none.

Anything else we need to know?

Screenshot 2024-06-08 at 00 15 48

Environment

# .tbls.yml

# DSN (Database Source Name) to connect database
dsn: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable

# Path to generate document
# Default is `dbdoc`
docPath: ./doc/schema

include:
   - public.*

Sql Command:

CREATE TABLE IF NOT EXISTS roles (
    id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
    name VARCHAR UNIQUE NOT NULL,
    inherit_from UUID,
    FOREIGN KEY (inherit_from) REFERENCES roles(id) ON DELETE SET NULL,
    CHECK (inherit_from <> id)
);
uvulpos commented 3 weeks ago

Just out of curiosity: Is there a flag to make these comments less... interfering?

Screenshot 2024-06-08 at 00 27 01
k1LoW commented 3 weeks ago

The drawing of ER diagrams relies on Graphviz and there is no such flag at present.

If you find a way to support this in Graphviz, please let us know!

uvulpos commented 3 weeks ago

fyi: https://gitlab.com/graphviz/graphviz/-/issues/2554

uvulpos commented 3 weeks ago

can someone support here and give some insights? https://gitlab.com/graphviz/graphviz/-/issues/2554#note_1941974571