Sequelize-auto to the SQL Server database on Node JS

Asked

Viewed 390 times

0

I’m looking to migrate the tables from an existing SQL Server database on Node JS.

I made the connection to the bank and it returns me connected.

I then run the following command to migrate the tables to the models using my database credentials

sequelize-auto -o "./models" -d namedatabase -h localhost -u namedb -p 1433 -x passdb -e mssql

Then it returns me the following error:

  name: 'SequelizeConnectionError',
  message: 'Falha de logon do usuário \'\'.',
  :90) message: 'Falha de logon do usuário \'\'.', code: 'ELOGIN' } }
  Done!

But the database is properly connected with the corresponding user.

Does anyone have a solution to the problem? Not only with Sequelize, but a functional method for migrating tables.

I used the following Sequelize documentation: github.com/sequelize/sequelize-auto

Note: The Django Framework uses a tool called inspectdb that migrates all tables without any problem, if they can be based on it to better understand my problem.

thank you!

1 answer

0

I was with the same problem that you and I was able to solve according to Troubleshooting down below:

https://github.com/sequelize/sequelize-auto/issues/360

The problem is in the file node_modules\tedious\lib\connection.js

I altered of

this.fedAuthRequired = false;
this.fedAuthInfoToken = undefined;
let authentication;


if (config.authentication !== undefined) {
  if (typeof config.authentication !== 'object' || config.authentication === null) {
    throw new TypeError('The "config.authentication" property must be of type Object.');
  }

for

this.fedAuthRequired = false;
this.fedAuthInfoToken = undefined;
let authentication;
// Insert the following authentication object
config.authentication = {
  type: "default",
  options: {
    userName: config.userName,
    password: config.password
  }
};

if (config.authentication !== undefined) {
  if (typeof config.authentication !== 'object' || config.authentication === null) {
    throw new TypeError('The "config.authentication" property must be of type Object.');
  }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.