darold / ora2pg

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
http://www.ora2pg.com/
GNU General Public License v3.0
1.03k stars 343 forks source link

ENUM data type is not getting exported properly from MYSQL #1513

Closed ShivanshGahlot closed 2 years ago

ShivanshGahlot commented 2 years ago

Hey, I was trying to export the schema from my mysql instance and the ENUM data type is not getting exported properly. This is an issue with ora2pg built from commit hash: 24a4761fdd2d0e6f167807e3fba0576c5f0af491

Here is DDL of the original table:

CREATE TABLE `clothes` (
  `product_id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `fabric` text NOT NULL,
  `size` enum('small','medium','large') NOT NULL,
  PRIMARY KEY (`product_id`)
)

Exported table by using ora2pg built from commit hash: 24a4761fdd2d0e6f167807e3fba0576c5f0af491

CREATE TABLE clothes (
        product_id bigserial,
        name varchar(255) NOT NULL,
        fabric text NOT NULL,
        size , 6 NOT NULL,
        PRIMARY KEY (product_id)
) ;

Exported table by using ora2pg built from 23.1 release (This is working fine):

CREATE TYPE clothes_size_t AS ENUM ('small','medium','large');

CREATE TABLE clothes (
        product_id serial,
        name varchar(255) NOT NULL,
        fabric text NOT NULL,
        size clothes_size_t NOT NULL,
        PRIMARY KEY (product_id)
) ;

cc: @darold

darold commented 2 years ago

Right commit f9b2f62 fixes this regression.