Insert on migration

Can we insert some data if table is empty while running migration?
3 Replies
Angelelz
Angelelz12mo ago
Sure, you'll need manually add the queries that you need to run to the migration file
ashishansurkar
ashishansurkarOP12mo ago
Thanks, can you please guide more on this. Should I write queries into .sql migrations files or in the trypescript schema/config file ?
Angelelz
Angelelz12mo ago
I would like to say that unless you have a good reason to do this, is generally considered a bad practice Migrations are supposed to change the structure of your database, not the data inside. When this type of operations is needed, people would have a separated script to seed the database after the migration is successful
Want results from more Discord servers?
Add your server