Overriding MySQL Treatment of TINYINT(1) During Migration

The NuoDB Migrator allows you to override any default source data type to target data type mapping. MySQL has a connection property that can cause confusion. The MySQL JDBC driver treatsTINYINT(1)asBITby default, which sometimes is unwanted behavior. This can be manipulated by thetinyInt1isBitJDBC connection property.

If you connect to your source MySQL database using--source.url=jdbc:mysql://host/dbname?tinyInt1isBit=true(this is the default),TINYINT(1)will be converted toBITandnuodb-migratorwill transformBITtoBOOLEAN.

CREATE TABLE `t1`(`f1` TINYINT(1));

will render:

CREATE TABLE "t1" ("f1" BOOLEAN);

You can provide overrides on the command line to transformBIT(which originally wasTINYINT(1)) toSMALLINT. The combination:

--source.url=jdbc:mysql://host/dbname?tinyInt1isBit=true \ --type.code=java.sql.Types.BIT \ --type.size=0 \ --type.name=SMALLINT

will render:

CREATE TABLE "t1" ("f1" SMALLINT);

If you havetinyInt1isBit=falseset in the URL, use the following to produceSMALLINT(Note MySQL always reportsTINYINT(1)size as 3):

--source.url=jdbc:mysql://host/dbname?tinyInt1isBit=false \ --type.code=java.sql.Types.TINYINT \ --type.size=3 \ --type.name=SMALLINT