-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
thread 'main' panicked at 'Ident cannot be a number; use Literal instead' if enum field include numeric values #702
Comments
I feel like this is a duplicate issue #579 |
yes, the same problem. good to see already has PR |
But actually I am quite hesitant to merge that PR. @ttys3 can you explain the reasoning behind numeric enums? |
@tyt2y3 the table schema is from a very old project, probably at least 10 years ago. so it is not designed by me. it is just an old mysql db. I changed the column to in my situation, it figured me a lot of time to find out why this happend. I use a shell script (in Makefile) to generate each table, so I could find which table caused the panic (which I hope sea-orm-cli will tell me) sudo podman exec -ti mysql-server-host sh -c 'mysql -uroot -p$$MYSQL_ROOT_PASSWORD -e "SELECT table_name FROM information_schema.tables WHERE table_schema ='"'"'my-database-name'"'"'\G"' | rg TABLE_NAME | awk -F: '{print $$2}' > /tmp/tables.txt
for tbl in `cat /tmp/tables.txt`; \
do \
echo "generating $$(echo -e $${tbl} | tr -d '[:space:]')"; \
sea-orm-cli generate entity -t $$(echo -e $${tbl} | tr -d '[:space:]') -o src/entity; \
done |
Actually, this is a good suggestion. |
currently the output result of enabling I think we need a log level config, instead of put everything to debug log and only have a |
Description
panicked at 'Ident cannot be a number; use Literal instead' if enum field include numeric values
yes, I know. nobody should define a table using enum like this
enum('0','1')
this is terrible and very bad, but, this is a very old project.and I just got this problem
Steps to Reproduce
you will got panic:
Expected Behavior
no panic
Actual Behavior
panic
Reproduces How Often
always
Versions
sea-orm-cli 0.7.2
Additional Information
The text was updated successfully, but these errors were encountered: