Update table schema
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.
These are the errors thrown by an online validator using the old schema for reference
@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.
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 |
hey, can you give an example of a json file that fails the validation. the indices are stored as an array of strings
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 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
Yup, I imported the diagram from SQL at the beginning
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);
yep, it's the import that needs to be fixed. would you like to fix it or do i go ahead with it?