I’m writing a simple admin interface thats reading user data (skills)
from a comma separated file.
To clear the database before inserting new skills, I use
Then I insert the new values I read from a file. Everything goes well
up to the point where I see that auto-generated ID’s are not starting
from 1. They start off at 840 (responding to the number of skills
times the number of times I reloaded data).
From my log I can see that the SQL query that’s performed is DELETE
FROM… and not TRUNCATE (which resets the auto increment counter)
It seems that Skill.delete_all doesn’t reset the auto_increment
counter on the database table.
Hope you can help me with my questions here:
Q1: Is it a bug in Rails that Class.delete_all does not reset
Q2: Is there a workaround that I can use?
(for instance, how can I do an SQL query ‘TRUNCATE skills’)
Any help appreciated!
Capgemini Danmark A/S
+45 23 73 62 20 (Mobile)