araera111 / mysql-to-zod

convert mysql schemas into Zod Schemas
https://mysql-to-zod.pages.dev/
2 stars 1 forks source link

dev v2.2.5 : globalSchema constant incorrect when process run twice #170

Closed TonyGravagno closed 1 month ago

TonyGravagno commented 1 month ago

Steps to reproduce:

  1. Start with no schema files.
  2. Set config.js to process a single table.
    • My table has both INT and BIGINT.
  3. Generate schema.
    • globalSchema is correct.
  4. With no changes to anything, generate schema again.
    • The globalSchema.ts file is completely regenerated, only with INT, and not including MaxLength features.
  5. Delete globalSchema.ts.
  6. Generate schema.
    • globalSchema is correct.
araera111 commented 1 month ago

I will start working on #169 and #170 tomorrow evening. Unfortunately, I am quite busy with work today, so I won't have time to do any programming.

In light of my busy schedule, my daughter, concerned about my workload, tried to help by attempting to accompany me to work in my backpack. I have attached a photo of her here.

IMG20240910225240 (1)

TonyGravagno commented 1 month ago

Since I just made a lot of changes to outputToFile.ts for #157 - I will volunteer to fix this issue and retrofit that change 157 into the new dev code. I don't want you to spend too much time fixing something that will soon change radically or entirely.

Please see #157 and #171 first, and decide what you would like to do ... or what you would like me to do.

Arigatoo...

araera111 commented 1 month ago

This issue should have been resolved with #176 as well. The problem stemmed from the requirement of having two consecutive \n\n to properly parse key-value pairs. I have re-evaluated the underlying mechanism and now retrieve key-value pairs by counting tabs instead. The fix appears to address the issue with the test cases I have. If you encounter any unusual cases, please let us know.