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' });
)1 Reply
The correct way of doing this is to generate the migration files locally, commit them and have the the migrations being run on your CI/CD