pgsync icon indicating copy to clipboard operation
pgsync copied to clipboard

Adjacency list

Open Lelouch1 opened this issue 3 years ago • 6 comments

Hello, tell me please does it support adjacency list in schema definition? It looks like in same table, we have parent id, which refers to an id in the same table.

i try'd like this, but something went wrong...

[
  {
    "database": "test-db",
    "index": "test-index",
    "nodes": {
      "table": "table_for_example",
      "schema": "public",
      "columns": [],
      "children" : [
        {
          "table": "table_for_example",
          "relationship": {
            "variant": "object",
            "type": "one_to_many",
            "foreign_key": {
              "child": ["id"],
              "parent": ["parent_id"]
            }
          }
        }
      ]
    }
  }
]

Lelouch1 avatar Jun 14 '22 13:06 Lelouch1

Hi @Lelouch1 , I think this comment might help you.

Wild-Soul avatar Jun 15 '22 19:06 Wild-Soul

This is not supported yet. It was also requested here. I am still working on this

toluaina avatar Jun 15 '22 19:06 toluaina

@toluaina Thank you, I'll be waiting

Lelouch1 avatar Jun 16 '22 08:06 Lelouch1

@toluaina hi, saw the new release, do you solved the problem? thx:)

Lelouch1 avatar Jul 04 '22 13:07 Lelouch1

  • I'm afraid this was not solved in the new release.
  • Its a bit delicate which is why it wasn't done to start with.
  • I have started working on this as you can see from some of the files commited.

toluaina avatar Jul 05 '22 19:07 toluaina

Hi! Discover same error when try to add children from same table. Want to make flat architecture from inheritance with adjacency list schema

{
	"label": "children",
	"table": "same_table",
	"columns": [
		"id",
		"detail"
	],
	"relationship": {
		"type": "one_to_many",
		"variant": "object",
		"foreign_key": {
			"child": [
				"parent_id"
			],
			"parent": [
				"id"
			]
		}
	}
}

@toluaina May bee I can help you, if you look at this code fix example: image But still it wont track update parent if new child was added

skantrus avatar Sep 12 '22 15:09 skantrus