pesalink-database-package
v1.0.0
Published
To make it easy you can follow these steps.
Readme
Pesalink Database Package
Getting started
To make it easy you can follow these steps.
Create a package folder and initialize a project
mkdir knex-db-migrations
cd knex-db-migrations
npm init
Install dependencies
npm install knex mysql2 dotenv
Create Your Knex Migration Code
Create a directory src/ and inside it, create index.js which will handle the migration logic.
Create cli.js This file will allow you to generate migration files from the command line using Knex.
Create knexfile.js In this file, define your database connection configuration and where migration and seed files are located.
You can make this package executable from the command line by adding a bin field in package.json.
"main": "./src/index.js",
"bin": {
"shared-knex": "./src/cli.js"
}
To link package locally
npm link npm link knex-db-migrations
To see globel package / local package
npm ls -g --depth=0
Once you modify any file after that run below commands to use package locally
npm link knex-db-migrations
To publish package
npm login
npm publish
npm info <package-name> (to verify package info)
