I think it's better to truncate the tables than use delete(); Using delete() will empty the table, but the autoincrement ID remains the same. So, next time the Seeder is run, IDs start counting from the last autoincrement instead of 1. This can lead to inconsistent data. Since all 3 tables are related, the IDs should remain the same irrespective of the number of times the seeders are run.
Another reason is that using delete() leaves the tendency for duplicates. The name column is not set to be unique. So, each time I run the seeder, an exact data is duplicated in the table.
I think it's better to truncate the tables than use
delete()
; Usingdelete()
will empty the table, but the autoincrement ID remains the same. So, next time the Seeder is run, IDs start counting from the last autoincrement instead of 1. This can lead to inconsistent data. Since all 3 tables are related, the IDs should remain the same irrespective of the number of times the seeders are run.Another reason is that using
delete()
leaves the tendency for duplicates. Thename
column is not set to be unique. So, each time I run the seeder, an exact data is duplicated in the table.