Search code examples
mysqlgrailsgrails-orm

Grails Change ID type on existing database


I have an existing application in grails using mysql database with much data. The previous programmer uses int as id and I need to change to long as I'm running out of ids. I know that the change in the domain class does not update the column of the existing table. Do I change the type in mysql manually?


Solution

  • Yes, after changing the domain class change the column manually.

    Also, I suppose it's a good idea first to set dbUpdate to e.g. "create-drop" and try it (on another DB instance) to let Grails generate new schema and to see whether it looks as you expect.

    So, change the domain, generate test schema and check whether it is correct, then change the original DB manually.