Skip to content

MySQL2 Support. #151

@Niek-Veenstra

Description

@Niek-Veenstra

Hi everyone,

I came accross this project since i had to work with introspecting some foreign keys on a database table. This library comes in handy for that purpose.

Im currently using knex with mysql2 driver. But it is not supported. It would be nice to have this functionality since MySQL2 offers more features and better performance.

Will there be an implementation for this, or do you guys allow an implementation?

https://www.npmjs.com/package/mysql2

Now it throws an error because of the missing implementation.

export default function SchemaInspector(knex: Knex) {
  let constructor: SchemaInspectorConstructor;

  switch (knex.client.constructor.name) {
    case 'Client_MySQL':
      constructor = require('./dialects/mysql').default;
      break;
    case 'Client_PG':
      constructor = require('./dialects/postgres').default;
      break;
    case 'Client_SQLite3':
      constructor = require('./dialects/sqlite').default;
      break;
    case 'Client_Oracledb':
    case 'Client_Oracle':
      constructor = require('./dialects/oracledb').default;
      break;
    case 'Client_MSSQL':
      constructor = require('./dialects/mssql').default;
      break;

    default:
      throw Error('Unsupported driver used: ' + knex.client.constructor.name);
  }

  return new constructor(knex);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions