oslabs-beta / dBizzy

VSCode extension that renders real time ER diagrams and allows for quick querying.
MIT License
79 stars 18 forks source link

Preview database - do not show any entities and relations (SQLite) #23

Open amokmen opened 2 years ago

amokmen commented 2 years ago

Win10: VSCode 1.61.0, WSL Ubuntu

  1. Install extension.
  2. Run command "Preview database", choose *.sql file inside project folder.
  3. In new opened window "Preview Database" only 2 buttons and logo with title is shown.

SQLite:

CREATE TABLE IF NOT EXISTS tblWorkers (
    workerId INTEGER PRIMARY KEY AUTOINCREMENT,
    ctime INTEGER NULL
);

CREATE TABLE IF NOT EXISTS tblCards (
    cardId INTEGER PRIMARY KEY AUTOINCREMENT,
    cardHexNumber TEXT NOT NULL UNIQUE,
    personId INTEGER NOT NULL,
    FOREIGN KEY (personId) REFERENCES tblWorkers (workerId)
);

Problem is in 'AUTOINCREMENT' probably. Or in 'TEXT'. Or in foreign key.

mcl030 commented 2 years ago

Thanks for letting us know - we'll look into this and hopefully have fixes by the next update!

solumath commented 1 year ago

same problem as OP. Ubuntu 22.04 using oracle SQL, no diagrams at all, figured out it was because CHECK and CONSTRAINT after removing them it would generate normal table. Also generates inline comments as attributes of table

Oracle SQL

CREATE TABLE CUSTOMER_ORDER (
    ORDER_ID INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    DATE_ORDER TIMESTAMP NOT NULL,
    DATE_DEADLINE DATE NOT NULL,
    PRICE NUMBER(10,2) DEFAULT NULL,
    PAID NUMBER(1),                                         -- 0 not paid, 1 paid
    CUSTOMER_FK  INT NOT NULL,
    ADDRESS VARCHAR(255),

    CHECK(PAID IN (0,1)),

    CONSTRAINT CUSTOMER_CONSTRAINT FOREIGN KEY (CUSTOMER_FK) REFERENCES CUSTOMER (CUSTOMER_ID)
        ON DELETE SET NULL,
);

attach picture shows after removed CONSTRAINT and CHECK image