https://github.com/dveeden/tidb-migration-advisor
Migration advisor for migrations to TiDB
https://github.com/dveeden/tidb-migration-advisor
advisor migration mysql tidb
Last synced: 7 days ago
JSON representation
Migration advisor for migrations to TiDB
- Host: GitHub
- URL: https://github.com/dveeden/tidb-migration-advisor
- Owner: dveeden
- License: apache-2.0
- Created: 2026-02-22T09:55:09.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-22T10:11:30.000Z (4 months ago)
- Last Synced: 2026-06-24T05:41:37.882Z (10 days ago)
- Topics: advisor, migration, mysql, tidb
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TiDB Migration Checker
Checks queries to see which ones may not work with TiDB
## Usage
For a single query
```
$ ./tidb-migration-advisor -query 'SELECT 1 FOR UPDATE SKIP LOCKED'
```
For a file with multiple queries
```
./tidb-migration-advisor -file dump.sql
```
To fetch information from a server
```
./tidb-migration-advisor -dsn 'root@127.0.0.1:3306/test'
```
```
$ ./tidb-migration-advisor -h
Usage of ./tidb-migration-advisor:
-dsn string
MySQL datasource name
-error-only
only show reports with errors (only for lists of text reports)
-file string
MySQL datasource name
-format string
output format: json or text (default "json")
-query string
query string
-show-parsing-info
show query parsing details, like AST
```
## Example
```
$ ./tidb-migration-advisor -query 'CREATE TABLE t AS SELECT 1'
Query Compatibility Report:
{
"query": "CREATE TABLE t AS SELECT 1",
"table": {
"schema": "",
"table": ""
},
"query_restored": "CREATE TABLE `t` AS SELECT 1",
"parser_error": "",
"checker_errors": [
"CREATE TABLE...SELECT is not supported"
],
"advise": null
}
```
```
$ ./tidb-migration-advisor -query 'CREATE TABLE t AS SELECT 1' -format text
Query Compatibility Report:
----------------------------------------------------------------
Query: CREATE TABLE t AS SELECT 1
❌ Check error 0: CREATE TABLE...SELECT is not supported
```
## Related resources
- https://docs.pingcap.com/tidb/stable/mysql-compatibility/
- [MySQL 8.0 Compatibility](https://github.com/pingcap/tidb/issues/7968)
- https://docs.pingcap.com/tidb/stable/migrate-from-mariadb/
## Tested
- If query is parsed by the TiDB parser
- If any functions are known TiDB functions
- Various checks for statements and options that are parsed, but are known not to work.
## Not tested
- If table and column names actually exist.
- If arguments to a function are valid.
- Combination of charset and collation make sense
- Dependencies between operations for ALTER statements
## Development
### Resources
- https://pkg.go.dev/github.com/pingcap/tidb/pkg/parser
- https://pkg.go.dev/github.com/pingcap/tidb/pkg/parser/ast
### TODO & Ideas
- Add query source for MySQL binlog (DDL statements)