Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marks failed migrations as completed #72

Closed
ku1ik opened this issue May 13, 2016 · 15 comments
Closed

Marks failed migrations as completed #72

ku1ik opened this issue May 13, 2016 · 15 comments

Comments

@ku1ik
Copy link

ku1ik commented May 13, 2016

I just experienced this: https://gist.github.com/sickill/d5468aa92a0c390bfe39f193d44f1295

You can see it failed to apply both migrations from the file, yet it still marked it as complete, and I can't rollback now (need to manually delete from schema_migrations).

Using migratus 0.8.13 and org.postgresql/postgresql "9.4-1201-jdbc41".

@yogthos
Copy link
Owner

yogthos commented May 13, 2016

Could you try this with the latest version [migratus "0.8.17"]?

@ku1ik
Copy link
Author

ku1ik commented May 13, 2016

I think I was getting #68 with the latest, but I'll check again and report.

@yogthos
Copy link
Owner

yogthos commented May 13, 2016

Yeah, HugSQL got updated to support the changes in clojure.java.jdbc, so latest versions should work.

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

Just checked on 0.8.22, I'm still getting clojure.lang.PersistentVector cannot be cast to clojure.lang.Named. Note, I'm not using HugSQL.

@yogthos
Copy link
Owner

yogthos commented Jun 9, 2016

The problem is that clojure.java.jdbc API changed in version 0.6.x, so any code using the old API is incompatible with it. So it sounds like you have some code that depends on the older API or there's a bug in migratus where it's trying to call the old API still. If you could paste the new stack trace, I can help narrow this down.

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

Exception in thread "main" java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named, compiling:(/tmp/form-init6483539764896810180.clj:1:73) at clojure.lang.Compiler.load(Compiler.java:7391) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$init_opt.invokeStatic(main.clj:277) at clojure.main$init_opt.invoke(main.clj:277) at clojure.main$initialize.invokeStatic(main.clj:308) at clojure.main$null_opt.invokeStatic(main.clj:342) at clojure.main$null_opt.invoke(main.clj:339) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named at clojure.core$name.invokeStatic(core.clj:1546) at clojure.core$name.invoke(core.clj:1540) at clojure.java.jdbc$as_sql_name.invokeStatic(jdbc.clj:67) at clojure.java.jdbc$as_sql_name.invoke(jdbc.clj:56) at clojure.java.jdbc$create_table_ddl$spec_to_string__919.invoke(jdbc.clj:1056) at clojure.core$map$fn__4785.invoke(core.clj:2646) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.LazySeq.first(LazySeq.java:71) at clojure.lang.RT.first(RT.java:667) at clojure.core$first__4339.invokeStatic(core.clj:55) at clojure.string$join.invokeStatic(string.clj:180) at clojure.string$join.invoke(string.clj:180) at clojure.java.jdbc$create_table_ddl.invokeStatic(jdbc.clj:1060) at clojure.java.jdbc$create_table_ddl.doInvoke(jdbc.clj:1045) at clojure.lang.RestFn.invoke(RestFn.java:423) at migratus.database$init_schema_BANG_$fn__1210.invoke(database.clj:255) at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:584) at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:557) at clojure.lang.RestFn.invoke(RestFn.java:425) at migratus.database$init_schema_BANG_.invokeStatic(database.clj:249) at migratus.database$init_schema_BANG_.invoke(database.clj:248) at migratus.database.Database.connect(database.clj:291) at migratus.core$run.invokeStatic(core.clj:24) at migratus.core$run.invoke(core.clj:21) at migratus.core$migrate.invokeStatic(core.clj:63) at migratus.core$migrate.invoke(core.clj:60) at user$eval1301.invokeStatic(form-init6483539764896810180.clj:1) at user$eval1301.invoke(form-init6483539764896810180.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.load(Compiler.java:7379) ... 14 more

I'm using [org.postgresql/postgresql "9.4-1201-jdbc41"] and [korma "0.4.2"].

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

Ok, found it. [korma "0.4.2"] pulls in [org.clojure/java.jdbc "0.3.7"].

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

There is PR for this: korma/Korma#358 (which doesn't help me right now but yeah...)
Thanks for help!

@ku1ik ku1ik closed this as completed Jun 9, 2016
@yogthos
Copy link
Owner

yogthos commented Jun 9, 2016

No worries, I think using an older version of migratus would be the way to go until Korma updates to use the new API.

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

Yeah, or one more reason to migrate to HugSQL :P

@yogthos
Copy link
Owner

yogthos commented Jun 9, 2016

Yeah it's very nice, I've migrated all my projects over at this point and very happy with it. :)

@ku1ik
Copy link
Author

ku1ik commented Jun 9, 2016

I thought about migrating gradually, but it seems HugSQL's and Korma's clojure.java.jdbc requirements are conflicting so would need to rewrite it at once (or find HugSQL version that works with [org.clojure/java.jdbc "0.3.7"]).

@yogthos
Copy link
Owner

yogthos commented Jun 9, 2016

I don't think the api changed much between 0.3.7 and 0.4.x, so you might be able to get away with a fairly recent version of HugSQL.

@timgilbert
Copy link

timgilbert commented Jun 10, 2016

FWIW, I've been able to get both HugSQL and Korma to coexist in harmony by using these dependencies:

  :dependencies [[com.layerware/hugsql "0.4.7" :exclusions [org.clojure/java.jdbc]]
                 [korma "0.4.2"]
                 [org.clojure/java.jdbc "0.4.2"]]

@ku1ik
Copy link
Author

ku1ik commented Jun 10, 2016

@timgilbert awesome, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants