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

Create table with empty default timestamp is incorrect #165

Closed
1 task done
wojtekn opened this issue Dec 11, 2024 · 0 comments · Fixed by #166
Closed
1 task done

Create table with empty default timestamp is incorrect #165

wojtekn opened this issue Dec 11, 2024 · 0 comments · Fixed by #166

Comments

@wojtekn
Copy link
Contributor

wojtekn commented Dec 11, 2024

When we dump an SQLite database table with a timestamp that has a default set to the empty string, it produces an SQL dump that can't be inserted into a MySQL database.

The following table:

CREATE TABLE `test_table` (
  `timestamp1` datetime NOT NULL,
  `timestamp2` date NOT NULL,
  `timestamp3` time NOT NULL,
  `timestamp4` timestamp NOT NULL,
  `timestamp5` year NOT NULL
);

Is exported as:

CREATE TABLE `test_table` (
  `timestamp1` datetime NOT NULL DEFAULT '',
  `timestamp2` date NOT NULL DEFAULT '',
  `timestamp3` time NOT NULL DEFAULT '',
  `timestamp4` timestamp NOT NULL DEFAULT '',
  `timestamp5` year NOT NULL DEFAULT ''
);

Done is:

  • DEFAULT '' does not appear in produced table structure
JanJakes added a commit that referenced this issue Dec 19, 2024
Fixes
#165

I propose to fix an issue where dumping the datetime field that has
empty value results with producing incorrect MySQL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant