^ And a follow-up question related to this case: I...
# orm-help
j
^ And a follow-up question related to this case: Is it possible to set up a script that only seeds the database when a new one is created? It's not obvious to detect when a new database is created from scratch vs. a migration is applied to an existing one
1
n
Hi @Jose 👋 Seed script is essentially a Typescript file so you can definitely add an
if
statement to add records only if a certain condition is met. I am not aware of any condition which would help in detecting if the database is new. Assuming if the database is new then all the tables would be empty, and when applying a migration the database won't be empty. Maybe this is something which could be useful?
j
Good idea, I guess it can perform an initial check to see if the database already contains data before seeding
n
That’s correct, you can definitely add an initial check 👍