Best Practices for adding rows in table after initial seed?


#1

I have a table populated by values from a seed file, but I need to add some more rows to the table. If I run the seed file again, I’ll get duplicates or the seed will fail from duplicate constraints. Should I add another seed file? Should I make a migration and run some insertions in it? Should I simply run some insertions in the repl?


#2

I’d probably add the new stuff to the existing seed file, so that a fresh run will get all the items, and then manually run the insertions in the repl… or yeah, another seed file maybe.

I usually set my seeders up to truncate the table before running, so that if I were to have the need to reseed in the future, I could without issue, but if I’m already in production I’m not gonna be running that seed again other than for a fresh deploy, or fresh install in a dev environment, so… whatever works best for you is probably best. :slight_smile: