Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice to store the created diagram #119

Open
ThomasSquall opened this issue Mar 29, 2021 · 3 comments
Open

Best practice to store the created diagram #119

ThomasSquall opened this issue Mar 29, 2021 · 3 comments

Comments

@ThomasSquall
Copy link

Hello everyone, I'm implementing flowy in an application with Laravel/MySQL backend.
I'm using the flowy.output() function to extract the diagram and send it to the backend through ajax in charge of storing the diagram for future updates.

The issue here is that storing it in the DB easily results in "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'html' at row 1" (roughly with 8/10 nodes).

I was thinking to store the diagram in a file but first I wanted to ask you if you have a better approach.

Thanks all!

@ravikoppula
Copy link

ravikoppula commented Apr 2, 2021

If you want to store the long nodes in the SQL database I prefer to store it in JSON format.

I used in my case 3800 Nodes converted into the JSON string and stored in the SQL. If you really want to store in the file format indeed can but security and weight of the node is matters.

@ThomasSquall
Copy link
Author

Hi @ravikoppula thanks for your answer.
So if I understand properly, you didn't store the actual output but you stored a sort of "tree" of the flow into a JSON and then, when reloading, you construct the html you need from the JSON tree and then input it to the flowy. Is that correct?

I was hoping for a quicker solution (like saving the flowy.output() and then importing it with flowy.input(output)) to implement this library into my project as I am not a true lover of Frontend but if this is the best option that I have surely I'll do it.

Thanks again for your help!

@juanmalunatic
Copy link

@ThomasSquall I believe what @ravikoppula means is to create a MySQL/Postgres column of the JSON data type. This way you can just store the output of flowy.output() (which is a JSON object) and load with flowy.import(output) as you intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants