dineug / erd-editor

Entity-Relationship Diagram Editor

Home Page:https://erd-editor.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import pgAdmin4 .pgerd file

leolcao opened this issue · comments

Thanks for this great ERD editor tool firstly, I am big fan of it!

Because now we has some legacy ERD file by using the pgAdmin4 ERD tool which is named with .pgerd,
May I ask in here does anyone know how to import it into this tool in VSCode?

I created a very simple ERD with 2 entities: students and department, the format is json actually.

{
  "version": "50700",
  "data": {
    "id": "286b7df3-ffb1-43bb-9272-b0ebc2b0a847",
    "offsetX": 0,
    "offsetY": -1,
    "zoom": 100,
    "gridSize": 15,
    "layers": [
      {
        "id": "00719531-7086-4a6d-b457-68f5bea0c8ab",
        "type": "diagram-links",
        "isSvg": true,
        "transformed": true,
        "models": {
          "85e1c8ed-7fc3-4a2c-a1ab-5fcc5c267a4b": {
            "id": "85e1c8ed-7fc3-4a2c-a1ab-5fcc5c267a4b",
            "locked": true,
            "type": "onetomany",
            "selected": false,
            "source": "bf3d12e7-d0b5-4ec4-a06e-21e286d8b2d2",
            "sourcePort": "42ea28bb-e2b6-4682-b290-369d2ddb323f",
            "target": "feef5f0e-e124-4dd9-bb78-997eb4691d21",
            "targetPort": "aea4d55b-e459-4377-8611-1d77e4ae095c",
            "points": [
              {
                "id": "1b020eef-26e8-49c9-85a0-af8b7639d5b4",
                "type": "point",
                "x": 534,
                "y": 147
              },
              {
                "id": "e06e329f-d757-4684-8fee-20c9c6464709",
                "type": "point",
                "x": 534,
                "y": 372
              },
              {
                "id": "1936d430-4d76-41c9-ba50-3643f3b0202b",
                "type": "point",
                "x": 534,
                "y": 372
              }
            ],
            "labels": [],
            "width": 1,
            "color": "gray",
            "curvyness": 50,
            "selectedColor": "rgb(0,192,255)",
            "data": {
              "local_table_uid": "feef5f0e-e124-4dd9-bb78-997eb4691d21",
              "local_column_attnum": "0",
              "referenced_table_uid": "bf3d12e7-d0b5-4ec4-a06e-21e286d8b2d2",
              "referenced_column_attnum": "0"
            }
          }
        }
      },
      {
        "id": "80a1c00b-a27c-483a-b93b-509d45c636d3",
        "type": "diagram-nodes",
        "isSvg": false,
        "transformed": true,
        "models": {
          "feef5f0e-e124-4dd9-bb78-997eb4691d21": {
            "id": "feef5f0e-e124-4dd9-bb78-997eb4691d21",
            "type": "table",
            "selected": false,
            "x": 330,
            "y": 270,
            "ports": [
              {
                "id": "aea4d55b-e459-4377-8611-1d77e4ae095c",
                "type": "onetomany",
                "x": 504,
                "y": 372,
                "name": "coll-port-0",
                "alignment": "right",
                "parentNode": "feef5f0e-e124-4dd9-bb78-997eb4691d21",
                "links": [
                  "85e1c8ed-7fc3-4a2c-a1ab-5fcc5c267a4b"
                ],
                "subtype": "many"
              }
            ],
            "name": "Untitled",
            "color": "rgb(0,192,255)",
            "portsInOrder": [],
            "portsOutOrder": [
              "aea4d55b-e459-4377-8611-1d77e4ae095c"
            ],
            "otherInfo": {
              "data": {
                "name": "students",
                "schema": "public",
                "columns": [
                  {
                    "name": "id",
                    "attnum": 0,
                    "cltype": "\"char\"",
                    "is_primary_key": true,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  },
                  {
                    "name": "name",
                    "attnum": 1,
                    "cltype": "\"char\"",
                    "is_primary_key": false,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  },
                  {
                    "name": "department",
                    "attnum": 2,
                    "cltype": "\"char\"",
                    "is_primary_key": false,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  }
                ],
                "primary_key": [
                  {
                    "columns": [
                      {
                        "column": "id"
                      }
                    ],
                    "include": []
                  }
                ]
              },
              "note": ""
            }
          },
          "bf3d12e7-d0b5-4ec4-a06e-21e286d8b2d2": {
            "id": "bf3d12e7-d0b5-4ec4-a06e-21e286d8b2d2",
            "type": "table",
            "selected": false,
            "x": 330,
            "y": 45,
            "ports": [
              {
                "id": "42ea28bb-e2b6-4682-b290-369d2ddb323f",
                "type": "onetomany",
                "x": 504,
                "y": 147,
                "name": "coll-port-0",
                "alignment": "right",
                "parentNode": "bf3d12e7-d0b5-4ec4-a06e-21e286d8b2d2",
                "links": [
                  "85e1c8ed-7fc3-4a2c-a1ab-5fcc5c267a4b"
                ],
                "subtype": "one"
              }
            ],
            "name": "Untitled",
            "color": "rgb(0,192,255)",
            "portsInOrder": [],
            "portsOutOrder": [
              "42ea28bb-e2b6-4682-b290-369d2ddb323f"
            ],
            "otherInfo": {
              "data": {
                "columns": [
                  {
                    "name": "id",
                    "attnum": 0,
                    "cltype": "\"char\"",
                    "is_primary_key": true,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  },
                  {
                    "name": "building",
                    "attnum": 1,
                    "cltype": "\"char\"",
                    "is_primary_key": false,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  },
                  {
                    "name": "name",
                    "attnum": 2,
                    "cltype": "\"char\"",
                    "is_primary_key": false,
                    "attnotnull": false,
                    "attlen": null,
                    "attprecision": null,
                    "attidentity": "a",
                    "colconstype": "n"
                  }
                ],
                "name": "department",
                "schema": "public",
                "primary_key": [
                  {
                    "columns": [
                      {
                        "column": "id"
                      }
                    ],
                    "include": []
                  }
                ]
              },
              "note": ""
            }
          }
        }
      }
    ]
  }
}

Because it supports basic SQL DDL import, try the following.
pg_dump -s

Thanks, I will try it.