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

feat: Dump functions to CSV files #1887

Merged
merged 14 commits into from
Jul 30, 2023
Merged

Conversation

DonkeyBlaster
Copy link
Member

@DonkeyBlaster DonkeyBlaster commented Jul 29, 2023

Yes I committed a plaintext password. I already reset it.

Automatically generates the db for https://wynntils-functions.donkeyblaster.tk/docs
I am happy with how the Java side of this works, so I will mark this for review. The website itself, and if we want to transfer it to the org can be discussed elsewhere.

@DonkeyBlaster DonkeyBlaster marked this pull request as ready for review July 29, 2023 18:30
@DonkeyBlaster DonkeyBlaster requested a review from a team as a code owner July 29, 2023 18:30
@magicus
Copy link
Member

magicus commented Jul 29, 2023

I am not very happy to include a postgres dependency. Can't you just dump the SQL to a text file and then import it into your database? That way you also don't need to worry about credentials.

Or possibly even better, write it to a json file. I am confident that there are tons of tools out there that can convert a simple json file into SQL insert statements.

@DonkeyBlaster
Copy link
Member Author

I will see what I can do about json instead, but if it does not work out I am also okay with keeping this on a separate branch or something like that

@DonkeyBlaster DonkeyBlaster changed the title feat: Dump functions to Postgres db feat: Dump functions to CSV files Jul 30, 2023
@magicus
Copy link
Member

magicus commented Jul 30, 2023

That seems much better. But it's not a CSV file, is it? Looks like pure SQL.

@DonkeyBlaster
Copy link
Member Author

DonkeyBlaster commented Jul 30, 2023

There are two generated CSV files. dumpFunctionsToCSV() and dumpArgumentsToCSV() both call writetoCSV(), which writes to arguments.csv and functions.csv. The column names are stored in two LinkedHashMaps at the top, and the related SQL for generating the tables is stored with them. The last function creates one massive SQL query that clears the db, generates the types enum from the types in Artemis, creates the tables according to the columns saved in the LinkedHashMaps, and copies to clipboard.

@magicus magicus added this pull request to the merge queue Jul 30, 2023
Merged via the queue into Wynntils:main with commit 2473d46 Jul 30, 2023
2 checks passed
@DonkeyBlaster DonkeyBlaster deleted the db-posting branch July 30, 2023 17:03
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

Successfully merging this pull request may close these issues.

None yet

2 participants