Quantcast

How migrate with Autobase ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How migrate with Autobase ?

maxou
Hi,

I just have a simple question for anybody who have ever used Autobase : how migrate with autobase ?
I have a simple Migration (TestMigration.groovy) file created with the command "create-migration Test" :
changeSet(id:'Test', author:'Me') {
    createTable(tableName:"car") {
        column(name:"id", type:"int8") {
            constraints(nullable:"false", primaryKey:"true", primaryKeyName:"car_pkey")
        }
    }
}


I tried :
- the command : grails migrate
- put the dbCreate to "update" or "create-drop" and run the project.

It doesn't work.

Thanks for your help.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How migrate with Autobase ?

pledbrook
> I just have a simple question for anybody who have ever used Autobase : how
> migrate with autobase ?
> I have a simple Migration (TestMigration.groovy) file created with the
> command "create-migration Test" :
> changeSet(id:'Test', author:'Me') {
>    createTable(tableName:"car") {
>        column(name:"id", type:"int8") {
>            constraints(nullable:"false", primaryKey:"true",
> primaryKeyName:"car_pkey")
>        }
>    }
> }

Migration happens on application startup. Are you saying that the
"car" table isn't created? Do you have a domain class called Car? Do
you have a ./migrations/changelog..groovy file? What's in it?

Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How migrate with Autobase ?

maxou
Thanks for your help.

Yes, the "car" table is not created.

In fact, in the console, I had :
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
...
2010-05-26 13:41:01,264 [main] ERROR AutobaseGrailsPlugin  - Error during Autobase migration
liquibase.exception.LockException: Could not acquire change log lock.  Currently locked by UNKNOWN
        at liquibase.lock.LockHandler.waitForLock(LockHandler.java:170)
        at liquibase.LiquibaseDsl.update(LiquibaseDsl.groovy:60)
        at liquibase.LiquibaseDsl$update.call(Unknown Source)
        at autobase.Autobase.migrate(Autobase.groovy:42)
        at autobase.Autobase$migrate.call(Unknown Source)
        at AutobaseGrailsPlugin$__clinit__closure9.doCall(AutobaseGrailsPlugin.groovy:89)
        at AutobaseGrailsPlugin.invokeMethod(AutobaseGrailsPlugin.groovy)
        at AutobaseGrailsPlugin$_closure2.doCall(AutobaseGrailsPlugin.groovy:103)
        at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:135)
        at grails.web.container.EmbeddableServer$start.call(Unknown Source)
        at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
        at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
        at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:282)
        at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
        at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
        at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
        at _GrailsRun_groovy.runInline(_GrailsRun_groovy:115)
        at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
        at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
        at RunApp$_run_closure1.doCall(RunApp.groovy:33)
        at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
        at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
        at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:344)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
        at gant.Gant.dispatch(Gant.groovy:334)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.processTargets(Gant.groovy:495)
        at gant.Gant.processTargets(Gant.groovy:480)
init


I don't have domain-class called Car, I supposed Grails would update the database with the update mode and not with autobase.

My changelog.groovy file :

// The overall database change log
databaseChangeLog(logicalFilePath:'helloworld-autobase') {
  includeAll('./migrations')
}


EDIT : I've found ! It was just a row in the table databasechangeloglock which caused the problem.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How migrate with Autobase ?

pledbrook
> In fact, in the console, I had :
> Waiting for changelog lock....
> Waiting for changelog lock....
> Waiting for changelog lock....
> Waiting for changelog lock....
> Waiting for changelog lock....
> ...
> 2010-05-26 13:41:01,264 [main] ERROR AutobaseGrailsPlugin  - Error during
> Autobase migration
> liquibase.exception.LockException: Could not acquire change log lock.
> Currently locked by UNKNOWN
>        at liquibase.lock.LockHandler.waitForLock(LockHandler.java:170)

Liquibase (the underlying library used by Autobase) uses a table to
determine whether another process is performing a migration. This
table can remain in a "locked" state if a migration terminates
abnormally. You can rectify if by executing this SQL against the
database:

    delete from liquibasechangeloglock;

Hope that helps,

Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How migrate with Autobase ?

maxou
Okay,

It's what I've done. It works correctly.

Thank you for your help.
Loading...