mjs-db-migrator

1.0.0 • Public • Published

DataBase migrator for mysql

  • Add script to your package.json
{
"db:setup": "node --experimental-modules --no-warnings ./src/db/migrate.mjs"
}
  • Create migrate.mjs file
import migrate from 'mjs-db-migrator'
 
migrate({
  config: {
    MYSQL_USER: 'root',
    MYSQL_PASSWORD: 'root',
    MYSQL_DATABASE: 'test',
    MYSQL_HOST: 'localhost'
  },
  dir: './src/db/migrations',
  migrations: [
    // 'users'
  ]
})
  • if migrations array not specified or empty then all tables in database will be deleted, else only specified tables will be deleted
  • dir is that directory where migrations can be found

Readme

Keywords

Package Sidebar

Install

npm i mjs-db-migrator

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

41.4 kB

Total Files

14

Last publish

Collaborators

  • kaprisa57