Automating migration

I am considering adding code to run a migration within my server startup. Basically, any time the server starts, the migration will run. The idea is that when the code is updated and the server restarts, the database stays up to date.

My questions: a) is there a way programmatically to determine if there is a need to do a migration? b) is there are a harm in running the migration every time you start up your server (migrate(database, { migrationsFolder: './db/drizzle' });)
Was this page helpful?