2

I'm using Grails 1.3.7 and the db-migration plug-in.

I have generated a chagelog.groovy-file containing my delta, I set theese properties:

grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy‘]

Now in my Datasource.groovy I have the the dbCreate to update.

I start my application and it tells me that the table I have in my delta is already created.

Any ideas on this?

Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
marko
  • 3,736
  • 6
  • 29
  • 46

1 Answers1

7

You don't need to set any dbCreate option in your DataSource.groovy.

The migration plugin manages all necessary operations if you specified your delta correctly.

Example part of your DataSource.groovy:

production {
   dataSource {
      dbCreate = ""
      url = "yourDBUrl"
      username = "yourUser"
      password = "yourPassword"
   }
} 
aiolos
  • 4,637
  • 1
  • 23
  • 28
  • You mean this should be enough: grails.plugin.databasemigration.updateOnStart = true – marko Mar 21 '12 at 12:16
  • 1
    No - you have to edit your `DataSource.groovy` as seen above (I updated my answer) – aiolos Mar 21 '12 at 13:15
  • 1
    You might also want to mark your existing database as already synchronized so it doesn't try to apply the changesets that are already there. – Tomas Lin Mar 22 '12 at 07:54
  • Is it safer to set `dbCreate = "validate"` to ensure that the application doesn't try to run against a DB with an incorrect schema? – cdeszaq Apr 06 '12 at 19:13