Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Unable to process a line with a primary key set to zero #103

Open
ragusa87 opened this issue Nov 9, 2022 · 1 comment
Open

Unable to process a line with a primary key set to zero #103

ragusa87 opened this issue Nov 9, 2022 · 1 comment

Comments

@ragusa87
Copy link

ragusa87 commented Nov 9, 2022

First at all, thanks for this wonderful project.

I am having an issue with a primary key having the zero value
(It's an existing database, don't ask me how it happens)

How to reproduce

Given the following schema:

CREATE TABLE `my_table` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `label` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=3745 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci

I insert a record with a primary key set to zero:

TRUNCATE my_table;
ALTER TABLE my_table CHANGE id id INT(10) UNSIGNED NOT NULL;
INSERT INTO my_table (id, label) VALUES (0, 'test 0');
INSERT INTO my_table (id, label) VALUES (1, 'test 1');
select * from my_table

If I run the tool with the config below, the entry 0 is not altered:

entry:
  my_table:
    columns:
      label:
        formatter: firstName

Other entry are changed

@peterjaap
Copy link
Contributor

Have you set SET sql_mode='NO_AUTO_VALUE_ON_ZERO'; ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants