This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-15
Channels
- # beginners (34)
- # boot (6)
- # cider (20)
- # cljs-dev (5)
- # clojure (7)
- # clojure-austin (1)
- # clojure-dusseldorf (10)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (7)
- # cursive (1)
- # datomic (6)
- # defnpodcast (1)
- # hoplon (2)
- # luminus (32)
- # lumo (9)
- # nrepl (2)
- # nyc (1)
- # off-topic (18)
- # onyx (9)
- # portkey (3)
- # re-frame (27)
- # reagent (102)
- # shadow-cljs (70)
- # tools-deps (25)
- # vim (2)
Hi 👋:skin-tone-5: / looking for some guidance on a freshly scaffolded luminus app -
lein new luminus <app> +cljs +http-kit +postgres +graphql +re-frame +sassc
// Luminus version 2.9.11.14
I'm looking to add a migration but cant find the command to run, do i need to add migratus to my dependencies ?
ive seen this elsewhere on the web but its not working locally lein migratus create foobar
it looks like luminus can run migrations out of the box but not create them ? is that right ?
@dviramontes the latest version of the template moved to managing migrations from the REPL
the user
namespace found in env/dev/clj/user.clj
provides some helper functions for running and creating migrations
(defn reset-db []
(migrations/migrate ["reset"] (select-keys env [:database-url])))
(defn migrate []
(migrations/migrate ["migrate"] (select-keys env [:database-url])))
(defn rollback []
(migrations/migrate ["rollback"] (select-keys env [:database-url])))
(defn create-migration [name]
(migrations/create name (select-keys env [:database-url])))
the main reason is that clj runtime takes a while to warm up, so running stuff from the REPL is much faster
to make a migration you can just run (create-migration "foo")
and it will create up/down files
@yogthos gotcha, that makes / thanks!
> (create-migration "foo")
> IllegalArgumentException find not supported on type: mount.core.DerefableState clojure.lang.RT.find (RT.java:863)
> user=> *ns*
> #object[clojure.lang.Namespace 0x3961b716 "user"]
the database state has to be loaded, whenever you see mount.core.DerefableState
errors it just means that the resource hasn't been initialized
ahhh make sense!
i just ran (restart) and then (create-migration "foo") worked!
thanks for much @yogthos!!!
this only happens until you actually start using the db in the app, once the namespace is referenced somewhere the state will be started automatically
hi, I’m getting some werid issues creating new project the template doens’t seem to be paying attention to the options
@eoliphant could you give a bit more details on what's happening?
sure, basically i seem to just get a default project. I even tried just cutting and pasting one of the examples from the site. It’s weird because I’ve used it dozens of times with no problem.
yeah super. they’re just maven resoruces right? will try maybe deleting it from my local repo
and yeah doing rm -rf ~/.m2/repository/luminus/lein-template
should clear the cached version