Search code examples
mysqldatabasegrailsdbmigrate

Grails DB Migration - how to change decimal db field to have scale property of 3?


In order to change the decimal field I have in my table, I need to know how to have a DB migration code to have this change.

Currently the field is represents as (19,2) and need to changed to (19,3) with 3 floating digits after the point.

My database is MySql.

Thanks!


Solution

  • In documentation of LIQUIBASE, have a attr called modifyDataType.

    Try this:

    databaseChangeLog {
        changeSet(author: 'author', id: '1234') {
            modifyDataType(columnName: 'column', newDataType: 'DECIMAL(19,3)')
        }
    }
    

    I think this works fine.