Knex is an SQL query builder in both Node.js and the browser https://knexjs.org/.
First prepare a knexfile.js in the root of your project directory with the following settings:
module.exports = {
development: {
client: 'mysql',
connection: {
host : process.env.DB_HOST,
user : process.env.DB_USERNAME,
password : process.env.DB_PASSWORD,
database : process.env.DB_NAME,
}
}
}
At the root of your project directory, run the following command in your terminal:
docker run --rm -v ${root_dir}:/src
--network ${network_used_by_your_mysql_and_node_project} hxhroniegss/knex
/bin/ash -c "knex migrate:make create-sample-table"
NOTE For running mysql and node/reactjs, you can use these images:
Content type
Image
Digest
Size
25.7 MB
Last updated
over 7 years ago
docker pull hxhroniegss/knex