This repository contains a few SQL scripts designed to facilitate the data type comparison and transformation of tables within a MySQL environment. These scripts are useful for ensuring data type consistency or preparing for data migrations.
Contains SQL commands to create test tables (source_tbl and target_tbl) in the test schema. These tables are used to demonstrate and test the functionality of the other scripts in the repository.
This script compares the data types of corresponding columns between two tables (source_tbl and target_tbl) within the test schema. It helps identify discrepancies in column data types to ensure consistency before data migration.
Generates dynamic SQL statements for transforming and aligning data types between two tables (source_tbl and target_tbl) within the test schema. It is useful for data migration tasks where data types between the source and destination tables differ and require conversion to match the destination.
- Clone the repository and its submodules:
git clone --recurse-submodules https://github.com/masaki9/compare_table_column_data_types.git-
Execute the SQL scripts in your MySQL environment.
-
Modify the scripts as per your specific requirements.
This repository includes a mysql_docker submodule. This Docker setup allows you to quickly deploy a MySQL environment for executing the included SQL scripts.
Navigate to the MySQL docker container directory:
cd compare_table_column_data_types/mysql_dockerFollow the instructions in mysql_docker/README.md to start the MySQL container.