luminus-framework / luminus-framework/luminus
REPL instructions in migrations.html not working
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 626
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
To interactively create a new migration, https://luminusweb.com/docs/migrations.html tells you to do this:
```
(mount.core/start #'.db.core/*db*)
(user/create-migration "add-users-table")
```
I can not get this to work. Fresh sample project created this week via `lein new luminus foobar +postgres`, then adjusting `:database-url` in `dev-config.edn`, the db connection is known to work via `lein run`.
This is what I get:
```
$ cd foobar
$ lein repl
user=> (mount.core/start #'foobar.db.core/*db*)
Execution error (ClassCastException) at foobar.db.core/eval13540$fn (core.clj:14).
class mount.core.DerefableState cannot be cast to class clojure.lang.IFn (mount.core.DerefableState is in unnamed module of loader clojure.lang.DynamicClassLoader @57540fd0; clojure.lang.IFn is in unnamed module of loader 'app')
### this is the error that confuses me
user=> (user/start)
2021-12-30 09:48:46,579 [nREPL-session-b1f4b012-2cd9-4cfa-87a4-e9f735c8e430] ERROR luminus.http-server - server failed to start on port: 3000
java.lang.RuntimeException: java.net.BindException: Address already in use
# this is not the problem, I know it's running, but I was playing around a bit
user=> (user/create-migration "foo" )
nil
### nothing happened
user=> (mount.core/start #'foobar.db.core/*db*)
{:started []}
### no more error
user=> (user/create-migration "change-something" )
nil
### still nothing happened
```
Also the line before the `mount.start` reads:
```
(defstate ^:dynamic *db*
:start (conman/connect! {:jdbc-url (env :database-url)})
:stop (conman/disconnect! *db*))
```
whereas in the code it is currently
```
(defstate ^:dynamic *db*
:start (if-let [jdbc-url (env :database-url)]
(conman/connect! {:jdbc-url jdbc-url})
(do
(log/warn "database connection URL was not found, please set :database-url in your config, e.g: dev-config.edn")
*db*))
:stop (conman/disconnect! *db*))
```
and I can't tell if that's a simplified version by default, or if it has changed meanwhile, or something else
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read migrations.html alongside the generated foobar.db.core code and reproduce the documented REPL commands in the sample project described. Check whether the instructions match the current template and verify that the corrected workflow creates a migration file without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Domain
- database, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100