yugabyte / yb-voyager

Data migration Engine for YugabyteDB database
38 stars 10 forks source link

[ORACLE] A Unique index which is also a primary key is not migrated #571

Open chetank-yb opened 2 years ago

chetank-yb commented 2 years ago

Jira Link: DB-13480 Schema used

CREATE TABLE employees
    ( employee_id    NUMBER(6)
    , first_name     VARCHAR2(20)
    , last_name      VARCHAR2(25)
     CONSTRAINT     emp_last_name_nn  NOT NULL
    , email          VARCHAR2(25)
    CONSTRAINT     emp_email_nn  NOT NULL
    , phone_number   VARCHAR2(20)
    , hire_date      DATE
    CONSTRAINT     emp_hire_date_nn  NOT NULL
    , job_id         VARCHAR2(10)
    CONSTRAINT     emp_job_nn  NOT NULL
    , salary         NUMBER(8,2)
    , commission_pct NUMBER(2,2)
    , manager_id     NUMBER(6)
    , department_id  NUMBER(4)
    , CONSTRAINT     emp_salary_min
                     CHECK (salary > 0)
    ) ;

CREATE UNIQUE INDEX EMAIL_UNIQUE
ON employees (email) ;

ALTER TABLE employees
ADD ( CONSTRAINT email_pk PRIMARY KEY (email));

SELECT column_name FROM all_cons_columns WHERE constraint_name = (
  SELECT constraint_name FROM user_constraints 
  WHERE UPPER(table_name) = UPPER('EMPLOYEES') AND CONSTRAINT_TYPE = 'P'
);

While in oracle both "EMAIL_UNIQUE" & "email_pk" are listed, the unique index "EMAIL_UNIQUE" is not listed in "INDEXES_Table.sql" after the export schema operation.

hbhanawat commented 3 weeks ago

@sanyamsinghal is this issue still relevant?

sanyamsinghal commented 3 weeks ago

yes @hbhanawat, this is an issue at ora2pg end, if i remember correctly.