README.md (1044B)
1 # @finwo/knex-tidb 2 3 TiDB dialect for Knex.js. Extends MySQL2 with no behavioral changes; purely an identity marker so upstream code can distinguish `tidb` from `mysql` / `mysql2`. 4 5 ## Why 6 7 TiDB speaks the MySQL wire protocol but diverges on certain DDL operations. This package provides a dedicated `tidb` dialect so upstream code can identify the client and apply targeted overrides, without polluting the generic mysql2 path. 8 9 No custom query compiler, table compiler, column compiler, or transaction class is needed; all behavior is inherited from MySQL2. 10 11 ## Usage 12 13 ```js 14 const Knex = require('knex'); 15 const Client_TiDB = require('@finwo/knex-tidb'); 16 17 const knex = Knex({ 18 client: Client_TiDB, 19 connection: { 20 host: 'localhost', 21 user: 'root', 22 password: '', 23 database: 'mydb', 24 }, 25 }); 26 ``` 27 28 ## Verification 29 30 - `knex.client.constructor.name` returns `'Client_TiDB'` 31 - `knex.client.driverName` returns `'tidb'` 32 - All MySQL2 query generation behavior is inherited 33 34 ## Requirements 35 36 - Node.js 16+ 37 - Knex ^3.0.0 (peer dependency)