Unable to create new tables via flyway.

862 views
Skip to first unread message

Michael Teo

unread,
Sep 15, 2014, 4:18:23 AM9/15/14
to ninja-f...@googlegroups.com
Hi, we are trying to add new tables to an Oracle 11g Express database, but we encountered the following errors.

There is only one SQL file in db/migrations folder named V1__.sql. We have tried to send the contents of this file directly to a Oracle client, and the tables are created successfully without any problems.

16:13:01.338 [main] INFO  ninja.lifecycle.LifecycleServiceImpl - Starting Ninja application...
16:13:01.719 [main] INFO  c.g.f.c.m.MetaDataTableImpl - Creating Metadata table: "BFS"."schema_version"
16:13:02.536 [main] INFO  c.g.flyway.core.command.DbMigrate - Current version of schema "BFS": << Empty Schema >>
16:13:02.536 [main] INFO  c.g.flyway.core.command.DbMigrate - Migrating schema "BFS" to version 1
16:13:02.596 [main] ERROR c.g.flyway.core.command.DbMigrate - Migration of schema "BFS" to version 1 failed! Please restore backups and roll back database and code!
16:13:02.653 [main] WARN  o.e.j.u.component.AbstractLifeCycle - FAILED o.e.j.s.ServletContextHandler@6ec4786e{/,null,STARTING}: ninja.lifecycle.FailedStartException: com.googlecode.flyway.core.api.FlywayException: Unable to insert row for version '1' in metadata table "BFS"."schema_version"
ninja.lifecycle.FailedStartException: com.googlecode.flyway.core.api.FlywayException: Unable to insert row for version '1' in metadata table "BFS"."schema_version"
    at ninja.lifecycle.LifecycleRegister.invokeTarget(LifecycleRegister.java:102) ~[ninja-core-3.2.0.jar:na]
    at ninja.lifecycle.LifecycleRegister.start(LifecycleRegister.java:54) ~[ninja-core-3.2.0.jar:na]
    at ninja.lifecycle.LifecycleServiceImpl.start(LifecycleServiceImpl.java:78) ~[ninja-core-3.2.0.jar:na]
    at ninja.NinjaDefault.onFrameworkStart(NinjaDefault.java:199) ~[ninja-core-3.2.0.jar:na]
    at ninja.servlet.NinjaBootstrap.boot(NinjaBootstrap.java:89) ~[ninja-servlet-3.2.0.jar:na]
    at ninja.servlet.NinjaServletListener.createNinjaBootstrap(NinjaServletListener.java:129) ~[ninja-servlet-3.2.0.jar:na]
    at ninja.servlet.NinjaServletListener.getInjector(NinjaServletListener.java:105) ~[ninja-servlet-3.2.0.jar:na]
    at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:47) ~[guice-servlet-4.0-beta4.jar:na]
    at ninja.servlet.NinjaServletListener.contextInitialized(NinjaServletListener.java:64) ~[ninja-servlet-3.2.0.jar:na]
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800) ~[jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:446) ~[jetty-servlet-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:792) ~[jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:296) ~[jetty-servlet-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744) ~[jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.server.Server.start(Server.java:357) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.server.Server.doStart(Server.java:324) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
    at ninja.standalone.NinjaJetty.start(NinjaJetty.java:136) [ninja-standalone-3.2.0.jar:na]
    at ninja.standalone.NinjaJetty.main(NinjaJetty.java:64) [ninja-standalone-3.2.0.jar:na]
Caused by: com.googlecode.flyway.core.api.FlywayException: Unable to insert row for version '1' in metadata table "BFS"."schema_version"
    at com.googlecode.flyway.core.metadatatable.MetaDataTableImpl.addAppliedMigration(MetaDataTableImpl.java:158) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.command.DbMigrate.applyMigration(DbMigrate.java:259) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.command.DbMigrate.access$700(DbMigrate.java:44) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:186) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:135) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:135) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:872) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:819) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1200) ~[flyway-core-2.3.1.jar:na]
    at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:819) ~[flyway-core-2.3.1.jar:na]
    at ninja.migrations.MigrationEngineFlyway.migrate(MigrationEngineFlyway.java:61) ~[ninja-core-3.2.0.jar:na]
    at ninja.migrations.MigrationInitializer.start(MigrationInitializer.java:51) ~[ninja-core-3.2.0.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_65]
    at ninja.lifecycle.LifecycleRegister.invokeTarget(LifecycleRegister.java:95) ~[ninja-core-3.2.0.jar:na]
    ... 22 common frames omitted
Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into ("BFS"."schema_version"."description")

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) ~[ojdbc14-10.2.0.3.0.jar:Oracle JDBC Driver version - "10.2.0.5.0"]

Raphael André Bauer

unread,
Sep 15, 2014, 12:40:34 PM9/15/14
to ninja-f...@googlegroups.com
Hi,

I have no idea what is going on, but it's imho for sure a Flyway
issue. "ORA-01400: cannot insert NULL int" looks suspicious to me. The
best way to get answers is to ask on StackOverflow via their tag
(http://flywaydb.org/support/). Flyway got a big and friendly
community - so I am sure they'll help.

Cheers,

Raphael
> --
> You received this message because you are subscribed to the Google Groups
> "ninja-framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ninja-framewo...@googlegroups.com.
> To post to this group, send email to ninja-f...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ninja-framework/c7e7d98b-1b57-459f-a7f4-774c34e7ea52%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.com

Michael Teo

unread,
Sep 17, 2014, 10:49:41 AM9/17/14
to ninja-f...@googlegroups.com
Hi, Raphael.
Thanks for your reply.

I'd managed to fix the problem by renaming db/migration/V1__.sql to db/migration/V1__Initial_schema.sql.

Cheers
Michael
Reply all
Reply to author
Forward
0 new messages