dre
dre

Reputation: 1037

Grails database migration - changing previous migrations

Unfortunately I have just noticed an issue in one of my previous migrations whereby I specify the baseTableSchemaName and now cannot create a database with an alternative name. I don't suppose anyone has any advice on how to change these and then clear the checksums in production. While the following;

grails dbm-clear-checksums

can be used in dev, for me, grails is not installed in production.

Is there anyway to automate this and worst case, can you simply update the databasechangelog table to set the MD5SUM to null?

Upvotes: 1

Views: 354

Answers (2)

dre
dre

Reputation: 1037

Here's a solution that I've since adopted, it may not be as elegant as I would have liked but might help someone else in a similar situation.

Simply update all of the databasechangelog records and set md5sum = null. New checksums are calculated on next database migration update.

Upvotes: 1

Andrej Istomin
Andrej Istomin

Reputation: 3043

I'm not aware of all the details of your problem, especially, the question is how many databasechangelog records need to be fixed. But I can share my experience what I usually did with my application(I use grails 2.5.5). For example, let's say, we have few migrations which were edited and checksums mismatch. I do the following:

  1. Create test database in development environment and synchronise all the migrations with the latests version on it. Thus, in development database you will have correct values of md5sum. The good thing is, those sums are environment independent and rely only on the migrations content itself.
  2. Go to production database and manually update records with the correct values taken from development database.
  3. Migrations should not have checksum conflicts anymore.

Upvotes: 0

Related Questions