Skip to content

error trying to migrate in postgres #120

@ashton

Description

@ashton

I'm trying to make a migration in postgres, I'm following the getting started and using the integreation with leiningen:

{:aliases {"migrate"  ["run" "-m" "investtrack.scripts.migration/migrate"]
            "rollback" ["run" "-m" "investtrack.scripts.migration/rollback"]}}
(ns investtrack.scripts.migration
  (:require [ragtime.jdbc :as jdbc]
            [ragtime.repl :as repl]))

(defn load-config []
  {:datastore  (jdbc/sql-database "jdbc:postgresql://postgres@localhost/investtrack")
   :migrations (jdbc/load-resources "migrations")})

(defn migrate []
  (repl/migrate (load-config)))

(defn rollback []
  (repl/rollback (load-config)))

Runing the command: $ lein migrate I get the following error:

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__449.invoke(jdbc.clj:1052)
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:1056)
at clojure.java.jdbc$create_table_ddl.doInvoke(jdbc.clj:1041)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at ragtime.jdbc$migrations_table_ddl.invokeStatic(jdbc.clj:15)
at ragtime.jdbc$migrations_table_ddl.invoke(jdbc.clj:14)
at ragtime.jdbc$ensure_migrations_table_exists.invokeStatic(jdbc.clj:43)
at ragtime.jdbc$ensure_migrations_table_exists.invoke(jdbc.clj:41)
at ragtime.jdbc.SqlDatabase.applied_migration_ids(jdbc.clj:62)
at ragtime.core$migrate_all.invokeStatic(core.clj:57)
at ragtime.core$migrate_all.invoke(core.clj:33)
at ragtime.repl$migrate.invokeStatic(repl.clj:32)
at ragtime.repl$migrate.invoke(repl.clj:17)
at investtrack.scripts.migration$migrate.invokeStatic(migration.clj:10)
at investtrack.scripts.migration$migrate.invoke(migration.clj:9)
at clojure.lang.Var.invoke(Var.java:375)
at user$eval5.invokeStatic(form-init4999925638129078061.clj:1)
at user$eval5.invoke(form-init4999925638129078061.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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions