apache / apache/grails-core

Grails Migration Plugin: wrong type mapping from grails dbm-generate-gorm-changelog

Open
#14,771 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Expected Behavior

I have used grails dbm-generate-changelog after my tables were generated by hibernate, and a byte[] field with maxSize constraint of 1GB was generated as LONGBLOB.

Then dropped all tables, and used grails dbm-generate-gorm-changelog which generates the changelog from the domains classes. For the same byte[] field this generated a BLOB, so it's not considering the constraint of 1GB since a BLOB can by 65 KB long, when LONGBLOB is up to 4GB.

So there is something in the gorm command that is not processing constraints correctly or in the same way as Hibernate is doing when geneating the tables on the DB.

### Actual Behaviour

Both grails dbm-generate-gorm-changelog and grails dbm-generate-changelog should generate the same column names, types and lengths.

### Steps To Reproduce

Steps are above.

My domain class looks like this:

```
class DvMultimediaIndex {

byte[] data

static constraints = {
data maxSize: 1073741824 // 1GB
}
}
```

### Environment Information

Linux Mint
| Grails Version: 5.3.3
| JVM Version: 11.0.20.1

### Example Application

_No response_

### Version

5.3.3 with database-migration:4.2.1 and liquibase-core:4.19.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the difference between grails dbm-generate-changelog and grails dbm-generate-gorm-changelog with the DvMultimediaIndex domain and its 1GB maxSize constraint. Compare the generated column type and length for data, and trace how each command processes the byte[] constraint. Done means both commands generate matching column names, types, and lengths.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.