How to seed tables in a particular order to maintain foreign key constraint?

I am trying to seed tables without using the Lucid ORM. Tables have many foreign key constraints so they must be seeded in a particular order. I cant seem to find any solution for this

Hi @amit2maha1 and welcome to community! :slight_smile:

Easiest is to put numbers in front of seeder files
01_users.js
02_profiles.js
etc

Other option is to disable foreign key check when seeding and then enabling it back again after seeding

2 Likes