How can i reset collection type ID field to "1" after deleting every thing

System Information
  • Strapi Version:
  • Operating System:
  • Database: sqllite
  • Node Version: 14.17.0
  • NPM Version: 6.14.13
  • Yarn Version: 1.22.10

i am trying to clean all of my collection type, and also reset the each collection type id to 1, i have more than ten collection type and for each i will like to reset the id to 1.

i will really appreciate any help.

thank you.

Since you are using SQLite this should be of assistance
Though you can also use something like SQLite Browser to do it with a GUI.

1 Like

this is how i have implemented it, but it’s not working, am i missing something, please help.
async afterDelete(data){

   await strapi.connections.default.raw("delete from sqlite_sequence where name='your_table'")


I would advise against constantly resetting the ID sequence, depending on your use-case, reusing IDs could cause a lot of other issues.


Thank you @DMehaffy and @Eventyret :grinning: i managed to fix my issue

I would manually delete the db table (.tmp) and run yarn build again. depends on the existing content of your database if you can live with wiping it all off

1 Like