Though this is likely not something that would be necessary in most cases, Snipe-IT provides a command-line tool that allows you to regenerate all of your asset tags.
This action is data destructive. It will permanently overwrite all of your asset tags and cannot be undone.
From the Snipe-IT project root, via command line, run:
php artisan snipeit:regenerate-tags
Override the next auto-increment in Admin > Asset Tags with this numeric value.
After the asset tags are regenerated, you'll want to update your Admin > Asset Tags next auto increment setting.
If you ONLY need to reset the zero fill on your asset tags, (for example to transition from
000000035) but need the asset tags otherwise unchanged, you can run the following, AFTER completing a backup of your database:
UPDATE table SET `asset_tag`=LPAD(`asset_tag`, 9, '0');
9 is the width of the new zero filled number.
To preview what would change without actually updating the asset_tags, you can run:
SELECT asset_tag,LPAD(`asset_tag`, 9, '0') from assets WHERE asset_tag != LPAD(`asset_tag`, 9, '0');
Updated 5 months ago