2 ms·
While I agree it has potential to be annoying in some environments, it's also trivially simple to work around. for tbl in $(mysql -BNe "SELECT DISTINCT TAB
by AaronBBrown 13y ago
While I agree it has potential to be annoying in some environments, it's also trivially simple to work around.
for tbl in $(mysql -BNe "SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE EXTRA = 'auto_increment' AND TABLE_SCHEMA = 'mydb'"); do
mysql -e "ALTER TABLE ${tbl} AUTO_INCREMENT=1" mydb
done
Run that just after importing your new schema.
Note: That code will require a bit of modification if you make the mistake of having spaces in your table name.