-
Notifications
You must be signed in to change notification settings - Fork 117
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
dbm-generate-gorm-changelog and dbm-generate-changelog both fail to generate the correct byte array MySQL type #253
Comments
Please specify the version of Grails® framework and the plugin version. |
Grails: 4.0.1 |
The problem also happens in the latest version of Grails and the latest versions of the migration plugin and Liquibase: Grails: 5.1.1 |
Maybe this issue is the same as #187 ? |
Maybe you should use |
abcfy2 Thanks for the help. Unfortunately, using sqlType: 'binary' still yields a similar result but without the constraint: column(name: "byte_data", type: "BLOB") |
Correction: I changed the constraint to nullable: true and that was what caused the result without the constraint. When using nullable: false again, the result of using abcfy2 suggestion (sqlType: 'binary') is the same as above. |
I find the reason, that's liquibase limitation. You can't use this in Maybe you have to drop and create your database and use: ./grailsw dbm-create-changelog changelog.groovy
./grailsw dbm-gorm-diff v1_init.groovy |
Liquibase BLOB type logic can be found here: https://github.com/liquibase/liquibase/blob/6a609ce2cacb67d9a3aeda3f23e942752f935229/liquibase-core/src/main/java/liquibase/datatype/core/BlobType.java#L19
So you have to use |
abcfy2, your insight is very close. Indeed creating the changelog from the database and not from GORM is the right workaround. I had to:
In addition, creating the changelog from the database using dbm-generate-changelog works in both Grails versions 4.0.1 and 5.1.1. Thanks very much for your help. |
I have a Grails application and using the database migration plugin (DBM) it fails to generate the correct MySQL type for byte arrays.
I have the following domain field with constraints and mapping:
Without the DBM plugin, the table in question would generate a field of type
MEDIUMBLOB
. If themaxSize
constraint is removed, then the generated type would beTINYBLOB
. I would expect the DBM plugin to generate from either the GORM classes or from the MySQL database the change sets for the byte array with its size constraint correctly but this is not the case.When I use
**dbm-generate-gorm-changelog**
or**dbm-generate-changelog**
they both result in the same column command inside the changeset as follows:It seems that the commands are ignoring the
maxSize
constraint specified above which causes a problem when we assign arrays longer than what theBLOB
type allows.We can manually change the type to
MEDIUMBLOB
in the change set although it seems like a hack. Not sure if this is a known problem or if it is a problem at all. I would appreciate any advice on this issue.The text was updated successfully, but these errors were encountered: