Knex
install
npm install knex --save
npm install -g knexUsage
Knex init // create a config file named knexfile.js
Knex migrate:make users // creat a migration file with timestamp
Knex migrate:latest // run the latest migration file/**
@type { Object.<string, import("knex").Knex.Config> }
*/
module.exports = {
development: {
client: 'mysql',
connection: {
database: 'myDataBase',
user: 'root',
password: ''
},
pool: {
min: 2,
max: 10
},
migrations: { tableName: 'knex_migrations' } },
staging: {
client: 'mysql',
connection: {
database: 'myDataBase',
user: 'root',
password: ''
},
pool: {
min: 2,
max: 10
},
migrations: { tableName: 'knex_migrations' } },
production: {
client: 'mysql',
connection: {
database: 'myDataBase',
user: 'root',
password: ''
},
pool: {
min: 2,
max: 10
},
migrations: { tableName: 'knex_migrations' } },
};Last updated