🍒 Fix remaining tinyint
booleans in MySQL (Backport #43296 to v49)
#43781
+615
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Liquibase changed their boolean type in MySQL from
bit(1)
totinyint(4)
in version 4.25.1. Our JDBC driver does not recognize theseas booleans, so we needed to migrate them to
bit(1)
s.As discussed here, we
changed all existing
boolean
types that were in the001_update_migrations.yml
but not the SQL initialization file.For new installations, this works: things in the SQL initialization file
get created with the
bit(1)
type.However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new
boolean
was added.In this case, I'll get the
boolean
from the liquibase migration ratherthan from the SQL initialization file, and it need to be changed to a
bit(1)
.I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type
tinyint
:Then wrote migrations. For each column, we:
turn it into a
bit(1)
,re-set the previously existing default value, and
re-add the NOT NULL constraint, if applicable.