Every new dev in our project is asked to do:
To create the database for the first time, run: $ mysql -u root -p < sql/schema.sql
We're using knex
internally in the project.
How can we use it to create the schema instead or manual mysql commands? How do we hook up npm for that?
Should we do it on npm install
, or npm init
? How do we hook up those build targets to knex
?
Generally speaking, a shell script may satisfy your needs:
npm scripts
is what you want, technically, it just open another shell and run commands in it.