ora2pg
ora2pg copied to clipboard
Sequences not exporting from MYSQL due to regression
Hi Team, I observed that after a recent commit, sequences are not getting exported properly for MYSQL.
Earlier int auto_increment
used to export as serial
Now its getting exported as numeric
The commit after which it changed:
59028d196fbde077af7f158b3afb33ebe54f0e2a
Sample source schema:
create table func_check (
id int primary key auto_increment,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(50),
gender VARCHAR(50),
ip_address VARCHAR(20)
);
Exported schema:
CREATE TABLE func_check (
id numeric(10) NOT NULL,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
gender varchar(50),
ip_address varchar(20),
PRIMARY KEY (id)
) ;
Thank You for your help.
When I export your example I have the following output with latest release v23.2:
CREATE TABLE func_check (
id bigserial,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
gender varchar(50),
ip_address varchar(20)
) ;
ALTER SEQUENCE func_check_id_seq RESTART WITH 1;
which looks correct. Does I have missed something?
Looks like a dependency issue, closing this for now. Will reopen if required. Thank You.
Hii Team, I still cannot see the sequences getting exported even after further observation.
create table sequence_check_1 (
id int primary key auto_increment,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(50),
gender VARCHAR(50),
ip_address VARCHAR(20)
);
Still exports as:
CREATE TABLE sequence_check_1 (
id numeric(10) NOT NULL,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
gender varchar(50),
ip_address varchar(20),
PRIMARY KEY (id)
) ;
Just for reference I'm using
Server version: 8.0.31 MySQL Community Server - GPL
on a Centos 7
machine
Using latest development code here is the export of the MySQL table:
CREATE TABLE sequence_check_1 (
id bigserial,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
gender varchar(50),
ip_address varchar(20)
) ;
ALTER SEQUENCE sequence_check_1_id_seq RESTART WITH 1;
The translation to bigserial of the auto_increment clause will automatically create sequence sequence_check_1_id_seq at table creation.
MySQL version: 8.0.31-0ubuntu0.20.04.1