db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Ignoring invalid configuration option passed to Connection: driver #753

Open erkage opened 3 years ago

erkage commented 3 years ago

Hi,

Can't figure out why i'm getting this msg when running pnpm db-migrate up: Ignoring invalid configuration option passed to Connection: driver

My database.json is:

{
  "dev": {
    "driver": "mysql",
    "host": "localhost",
    "port": "3306",
    "user": "root",
    "password": "",
    "database": "graphql-mysql-test"
  }
}

migration js is genereated with pnpm db-migrate create user:

...
exports.up = function(db, callback) {
  db.createTable('user', {
    id: {
      type: 'int',
      primaryKey: true
    },
    full_name: {
      type: 'string',
      length: 40
    },
    dob: {
      type: 'date'
    },
    email: {
      type: 'string',
      length: 50
    },
  }, function(err) {
    if (err) return callback(err);
    return callback();
  });
};
...

Versions: "db-migrate": "^1.0.0-beta.16", "db-migrate-mysql": "^2.2.0", node: v14.17.3

rriopel432 commented 3 years ago

This is actually coming from mysql's createConnection, not db-migrate. In your case, the dev configuration is passed directly to mysql's createConnection. createConnection isn't expecting the driver value so it complains. This would have to be fixed in db-migrate-mysql, not db-migrate.

vipulwairagade commented 2 years ago

@erkage were you able to fix this issue ? I'm also facing same issue.

GiveMeMoreKnowledge commented 2 years ago

@erkage вы смогли исправить эту проблему? Я также сталкиваюсь с той же проблемой.

You can fix this issue just add in node_modules/db-migrate-mysql/index.js exports.connect = function (config, intern, callback) { delete config.driver ..... }