Seeding with migrations

System Information
  • Strapi Version: 4.6.0
  • Operating System: Windows
  • Database: MySql

Hi guys - I’m currently looking at seeding some data in a Strapi database. For this, I thought I could use migrations. However - these migrations might occur on the same commit as the content-type creating the tables. As such - it fails.

As such - I’m wondering:

  • Am I using the right tool for the job please?
  • Is there a way for migrations to run after content types create their tables?

Thanks so much

You can use the bootstrap.js function part of the index :slight_smile:
You can seed the data there.

1 Like

Awesome! Thank you. I’m guessing I’ll probably need to create a seeding table to keep track of what seeders have run.


Not really what I do is query the table if it’s more then one result I don’t populate it. :relaxed: