surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.1k stars 84 forks source link

Bug: TYPE ANY SCHEMAFULL relates don't get visualized correctly #459

Closed agarfer1 closed 1 month ago

agarfer1 commented 1 month ago

Describe the bug

Both in the explorer, and in the designer, the tables that are of type TYPE ANY SCHEMAFULL are not visualized correctly.

In the explorer, the icon of those tables is a table, not the relation icon.

In the designer, those tables don't show any incoming or outgoing relationships.

Steps to reproduce

-- TABLE: child

DEFINE TABLE child TYPE ANY SCHEMALESS PERMISSIONS NONE;

-- TABLE: parent

DEFINE TABLE parent TYPE ANY SCHEMALESS PERMISSIONS NONE;

-- RELATE: has_parent

DEFINE TABLE has_parent TYPE ANY SCHEMALESS PERMISSIONS NONE;

DEFINE FIELD in ON has_parent TYPE record<child> PERMISSIONS FULL;
DEFINE FIELD out ON has_parent TYPE record<parent> PERMISSIONS FULL;

-- RELATE: loves

DEFINE TABLE loves TYPE ANY SCHEMALESS PERMISSIONS NONE;

DEFINE FIELD in ON loves TYPE record<child> PERMISSIONS FULL;
DEFINE FIELD out ON loves TYPE record<flavour> PERMISSIONS FULL;

-- TABLE: flavour

DEFINE TABLE flavour TYPE ANY SCHEMALESS PERMISSIONS NONE;

-- Inserting records

CREATE parent:John;

CREATE child:Mike;
CREATE child:Jessica;

CREATE flavour:Chocolate;
CREATE flavour:Strawberries;
CREATE flavour:Vanilla;

RELATE child:Mike->has_parent->parent:John;
RELATE child:Jessica->has_parent->parent:John;

RELATE child:Mike->loves->flavour:Chocolate;
RELATE child:Mike->loves->flavour:Strawberries;

RELATE child:Jessica->loves->flavour:Vanilla;

Expected behaviour

The correct icons and the incoming and outgoing relations showing.

Surrealist Environment

Surreal v.2 beta 3 x86_64, Surrealist 3 beta 2

Contact Details

No response

Is there an existing issue for this?

Code of Conduct

macjuul commented 1 month ago

Unfortunately Surrealist can only visualize edges with TYPE RELATION tables as these have defined IN and OUT tables, which Surrealist uses to draw the Designer view, while TYPE ANY does not. For that reason TYPE ANY tables are currently treated as normal tables