I’ve been trying to convert a dump-file generated from migration files using the PHP Laravel Framework.
We’re using PostgreSQL 13 and when i try to run
sql2dbml on the file, i get this error:
ERROR: You have a syntax error at "pgsql-schema.dump" line 1 column 1. Expected "ALTER", "COMMENT", "CREATE", "DROP", "INSERT", "RESET", "SELECT", "SET", "USE", end of input, or space but "P" found.
Has anyone used a dump file from Laravel with Postgres before? I tried it with mysql which worked!
Thanks for letting us know,
Can you give us the sql or dbml code that fails?
I would have to upload the file i think. I added an image with the first lines from the postgresql dump. The postgres dump file is full of text that couldn’t decoded by vscode. I don’t know if all postgresql dump files look like this, but it is generated using pg_dump.
Sorry, your content is not clear, I can’t help you. Do you have another way to post content here?
It looks like the pg_dump file is littered with some werid text encodings or binary that sql2dbml can’t work with. When i exported the columns using TablePlus export, it worked. But i need to have a completely automated way of getting the db structure, converting it into dbml and then build a dbdocs page.
You can try some options of pg_dump, here is its documentation. PostgreSQL: Documentation: 14: pg_dump or try adjust the encoding of vscode or open another editor.
I really don’t have enough content to help you and keeps in mind this is not a psql forum. If you have any problems relating to import/export dbml to/from sql, we’d be more than happy to help.