Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MySQL] Migrated tables CREATE TABLE syntax not idempotent #1359

Open
ssherwood opened this issue Mar 14, 2024 · 0 comments
Open

[MySQL] Migrated tables CREATE TABLE syntax not idempotent #1359

ssherwood opened this issue Mar 14, 2024 · 0 comments
Labels
triage Needs to be triaged

Comments

@ssherwood
Copy link

Running voyager to migrate a set of tables from MySQL (MariaDB 10.5) and identified a possible improvement.

Example:

DROP TABLE IF EXISTS `foo_table`;
CREATE TABLE `foo_table` (
  `FOO_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `BAZ_NM` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`FOO_ID`)
);

In the resulting output from Voyager, the table create looks like this:

CREATE TABLE foo_table (
    foo_id bigserial,
    bar_nm varchar(250),
    PRIMARY KEY (foo_id)
) ;
ALTER SEQUENCE foo_table_foo_id_seq RESTART WITH 1;

The original DROP TABLE IF EXISTS is ignored (which I think is a good thing) but I also think it is more appropriate for a Yugabyte DDL to attempt to produce properly idempotent statements as much as possible. At least a configuration option should be able to use CREATE TABLE IF NOT EXISTS syntax instead.

@github-actions github-actions bot added the triage Needs to be triaged label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant