- Create mysql schema and data diff script.
- Create markdown schema document.
- It is written in golang and can be built and used on any OS.
- Install golang latest. (https://golang.org/dl/)
- Download src
git clone https://github.com/jaksal/dbdiff.git
- Goto src folder
go get && go build
dbdiff -diff_type=schema
-source="uid:pwd@tcp(server_ip:port)/dbname"
-target="uid:pwd@tcp(server_ip:port)/dbname"
-output=output.sql
dbdiff -diff_type=data
-source="uid:pwd@tcp(server_ip:port)/dbname"
-target="uid:pwd@tcp(server_ip:port)/dbname"
-output=output.sql
dbdiff -diff_type=md
-source="uid:pwd@tcp(server_ip:port)/dbname"
-output=output.md
- The sample files are in the sample folder.
- output md file convert to pdf ==> ( https://github.com/jaksal/md2pdf )
dbdiff -diff_type=sql
-source="uid:pwd@tcp(server_ip:port)/dbname"
-output=output.sql
-include="test_" // include db object name containing test_
-exclude="test_" // exclude db object name containing test_
-output="[DATE]/output.sql" // create today date folder
-ignore_column=update_date // ignore column in data diff mode
When comparing tables, if only the column name has been changed, it cannot be known with sql alone, so drop the column and add a new one. Please note that data will be lost during this process.