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

Fix MySQL snapshot error #535

Merged
merged 8 commits into from
Nov 5, 2024
Merged

Fix MySQL snapshot error #535

merged 8 commits into from
Nov 5, 2024

Conversation

Tang8330
Copy link
Collaborator

@Tang8330 Tang8330 commented Nov 5, 2024

Problem

We previously mapped tinyint(1) to a boolean, this isn't accurate because tinyint(1) can accept values that are beyond 0 and 1.

What's unintuitive about this is that you can create a "boolean" column in MySQL:

ALTER TABLE foo ADD COLUMN bool_col BOOLEAN;

Which just maps to a tinyint(1) under the hood.

Later, you can actually do this and it would be valid.

UPDATE foo SET bool_col = 127;

Further context

The functionality of mapping 0 and 1 to a boolean column isn't going away. If you define the downstream column as a boolean column, Transfer will automatically convert the values for 0, 1 into false / true.

@Tang8330 Tang8330 marked this pull request as ready for review November 5, 2024 21:14
@Tang8330 Tang8330 requested a review from a team as a code owner November 5, 2024 21:14
@Tang8330 Tang8330 changed the title [WIP] Fix MySQL snapshot error Fix MySQL snapshot error Nov 5, 2024
@Tang8330 Tang8330 requested a review from nathan-artie November 5, 2024 21:29
if castValue == "0000-00-00" {
// MySQL supports '0000-00-00' for date columns
return nil, nil
parts := strings.Split(castValue, "-")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @nathan-artie I just added this

@Tang8330 Tang8330 merged commit 0dad82e into master Nov 5, 2024
6 checks passed
@Tang8330 Tang8330 deleted the debug branch November 5, 2024 22:42
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 this pull request may close these issues.

2 participants