adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.07k stars 191 forks source link

Missing type for instanceName in MssqlConnectionNode #916

Closed Imunal closed 1 year ago

Imunal commented 1 year ago

Information

Recently I found that the type is missing for instanceName in connection option for MSSQL. https://tediousjs.github.io/node-mssql#tedious

Package version

"@adonisjs/lucid": "^18.3.0"

Node.js and npm version

NodeJS: v18.12.1 NPM: 8.19.2

Sample Code (to reproduce the issue)

mssql: {
      client: 'mssql',
      connection: {
        user: Env.get('MSSQL_USER'),
        port: Env.get('MSSQL_PORT'),
        server: Env.get('MSSQL_SERVER'),
        password: Env.get('MSSQL_PASSWORD', ''),
        database: Env.get('MSSQL_DB_NAME'),
        options: {
          instanceName: 'sql2014',
        },
      },
      migrations: {
        naturalSort: true,
      },
      healthCheck: true,
      debug: false,
    },

Solution:

type MssqlConnectionNode = {
        server: string;
        domain?: string;
        connectionTimeout?: number;
        requestTimeout?: number;
        parseJSON?: boolean;
        options?: {
            encrypt?: boolean;
            useUTC?: boolean;
            tdsVersion?: string;
            appName?: string;
            instanceName?: string;
            abortTransactionOnError?: boolean;
            trustedConnection?: boolean;
            enableArithAbort?: boolean;
            isolationLevel?: 'READ_UNCOMMITTED' | 'READ_COMMITTED' | 'REPEATABLE_READ' | 'SERIALIZABLE' | 'SNAPSHOT';
            maxRetriesOnTransientErrors?: number;
            multiSubnetFailover?: boolean;
            packetSize?: number;
            trustServerCertificate?: boolean;
        };
    };
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.