drawdb icon indicating copy to clipboard operation
drawdb copied to clipboard

Update table schema

Open is-yusuf opened this issue 7 months ago • 8 comments

When exporting a diagram that contains a table with indices to JSON then importing it, an validation error occurs because the schema for the index on the table was not correctly setup leading to the file being considered an invalid json. image

These are the errors thrown by an online validator using the old schema for reference image

is-yusuf avatar May 18 '25 06:05 is-yusuf

@is-yusuf is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 18 '25 06:05 vercel[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2025 10:40am

vercel[bot] avatar May 18 '25 10:05 vercel[bot]

hey, can you give an example of a json file that fails the validation. the indices are stored as an array of strings image

1ilit avatar May 18 '25 10:05 1ilit

Strange, my fields are stored as an array of objects. This could be an import from SQL error instead. I'll update when I have new findings.

"fields": [ { "expr": { "type": "default", "value": "authuser_id" } } ]

is-yusuf avatar May 18 '25 21:05 is-yusuf

@is-yusuf i think i know what might have happened. did you by chance import the diagram from sql? my suspicion is that the index didnt get properly parsed after getting imported thats why it's imported as an expr

1ilit avatar May 18 '25 21:05 1ilit

Yup, I imported the diagram from SQL at the beginning

is-yusuf avatar May 18 '25 21:05 is-yusuf

Here's the most minimal SQL that when imported then exported to JSON reproduces the parsing error

CREATE TABLE table1 ( column1 DOUBLE PRECISION NOT NULL );

CREATE INDEX idx_table1_column1 ON table1(column1);

is-yusuf avatar May 18 '25 21:05 is-yusuf

yep, it's the import that needs to be fixed. would you like to fix it or do i go ahead with it?

1ilit avatar May 18 '25 23:05 1ilit