commandbox-modules / commandbox-migrations

MIT License
7 stars 9 forks source link

H2 embedded database problem #29

Open elenaaralla opened 3 years ago

elenaaralla commented 3 years ago

Hi,

I've some problem with commandbox-migrations and h2database...

If I do query from within my coldbox app using this settings:

this.datasources["testappdb"] = {
    class: 'org.h2.Driver'
    , connectionString: 'jdbc:h2:/Users/elena/coldbox-examples/testApp/database/appDB;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;' 
    , connectionLimit:100 // default:-1
    , validate:false // default: false
};

all is right!

But if I do migrate up from commandbox cli I've a lot of problem...

this is the last error:

> 27sec 561ms > * > CLI v5.2.1 > 06:13 PM > ~/coldbox-examples/testApp/ > testApp (1.0.0) > lucee 5.3.7 (stopped) >
> migrate up
ERROR (5.2.1+00295)                                                                                                                                                                                                                                                                                             Unable to resolve com.h2database [106](R 106.0): missing requirement [com.h2database [106](R 106.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.framework)(version>=1.5.0)) Unresolved requirements: [[com.h2database [106](R 106.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.framework)(version>=1.5.0))]
  caused by: org.osgi.framework.BundleException
  Unable to resolve com.h2database [106](R 106.0): missing requirement [com.h2database [106](R 106.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.framework)(version>=1.5.0)) Unresolved requirements: [[com.h2database [106](R 106.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.framework)(version>=1.5.0))]

/Users/elena/.CommandBox/cfml/modules/commandbox-migrations/modules/cfmigrations/modules/qb/models/Grammars/AutoDiscover.cfc: line 7
5: 
6:     function autoDiscoverGrammar() {
7:         cfdbinfo( type = "Version", name = "local.dbInfo" );
8: 
9:         switch ( dbInfo.DATABASE_PRODUCTNAME ) {

and this is the configuration in box.json

"cfmigrations":{
    "migrationsDirectory":"resources/database/migrations",
    "schema":"INFORMATION_SCHEMA",
    "connectionInfo":{
        "bundleName":"com.h2database",
        "bundleVersion":"1.4.199",
        "password":"",
        "connectionString":"jdbc:h2:/Users/elena/coldbox-examples/testApp/database/appDB;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;",
        "class":"org.h2.Driver",
        "username":""
    },
    "defaultGrammar":"AutoDiscover@qb"
}

more details on: https://stackoverflow.com/questions/67414843/error-schema-information-schema-not-found-running-migrate-up-on-h2-databa/67418432?noredirect=1#comment119198678_67418432

thank you, Elena