Tedious or Sequelize uses the wrong syntax for `findOne()`

前端 未结 6 1026
青春惊慌失措
青春惊慌失措 2021-02-06 08:51

I am using Sequelize with Tedious to access SQL Server 2008.

When I do a sequelizeModel.findOne() I get this exception -

Unhandled

6条回答
  •  -上瘾入骨i
    2021-02-06 09:48

    Checking code node_modules/sequelize/lib/dialects/mssql/query-generator.js saw that part

    const dbVersion = this.sequelize.options.databaseVersion;
    const isSQLServer2008 = semver.valid(dbVersion) && semver.lt(dbVersion, '11.0.0');
    

    So I just added my connection configuration:

    production: {
            dialect: 'mssql',
            databaseVersion: '10.50.6000',
            host: process.env.DB_HOST,
            username: process.env.DB_USER,
            password: process.env.DB_PASS,
            database: process.env.DB_NAME,
            dialectOptions: {
                options: {
                    useUTC: false,
                    dateFirst: 1,
                    enableArithAbort: true,
                    encrypt: false,
                },
            },
        },
    
    

提交回复
热议问题