Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL2 Support. #151

Open
NiekBoii opened this issue Jan 3, 2025 · 0 comments
Open

MySQL2 Support. #151

NiekBoii opened this issue Jan 3, 2025 · 0 comments

Comments

@NiekBoii
Copy link

NiekBoii commented Jan 3, 2025

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant