Skip to content

Commit 09d7ae9

Browse files
committed
Update README with duct.main changes
1 parent 3d239b0 commit 09d7ae9

File tree

1 file changed

+26
-45
lines changed

1 file changed

+26
-45
lines changed

README.md

+26-45
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Duct module.sql [![Build Status](https://github.com/duct-framework/module.sql/actions/workflows/test.yml/badge.svg)](https://github.com/duct-framework/module.sql/actions/workflows/test.yml)
22

3-
A [Duct][] module that adds [Integrant][] keys for a [hikari-cp][] SQL
3+
A [Duct][] module that adds [Integrant][] keys for a [HikariCP][] SQL
44
database connection pool and [Ragtime][] migrations to a configuration.
55

6+
This current version is experimental and will only work with the new
7+
[duct.main][] tool. The artifact group name has been changed to prevent
8+
accidental upgrades. The version prior to this change was: `0.6.1`.
9+
610
[duct]: https://github.com/duct-framework/duct
711
[Integrant]: https://github.com/weavejester/integrant
8-
[hikari-cp]: https://github.com/tomekw/hikari-cp
12+
[hikaricp]: https://github.com/brettwooldridge/HikariCP
913
[ragtime]: https://github.com/weavejester/ragtime
14+
[duct.main]: https://github.com/duct-framework/duct.main
1015

1116
## Installation
1217

@@ -20,57 +25,33 @@ Or to your Leiningen project file:
2025

2126
## Usage
2227

23-
To add this module to your configuration, add the `:duct.module/sql`
24-
key to your `config.edn` file:
25-
26-
```edn
27-
:duct.module/sql {}
28-
```
29-
30-
#### Optional Module Parameters
31-
32-
```edn
33-
:database-url STRING
34-
```
35-
JDBC URL for the connection pool. Overridden by `JDBC_DATABASE_URL`,
36-
`DATABASE_URL` environment variables or custom `:duct.database/sql`
37-
integrant key.
38-
39-
#### Integrant Keys
40-
41-
When prepped, the module will compile the following Integrant keys into
42-
your config:
43-
28+
Add the `:duct.module/sql` key to your Duct configuration:
4429

4530
```edn
46-
:duct.database.sql/hikaricp {
47-
:jdbc-url URL
48-
:logger #ig/ref :duct/logger
49-
}
50-
51-
:duct.migrator/ragtime {
52-
:database #ig/ref :duct.database/sql
53-
:strategy STRATEGY
54-
:logger #ig/ref :duct/logger
55-
:migrations []
56-
}
31+
{:duct.module/sql {}}
5732
```
33+
This module uses the Integrant [expand][] function to add the
34+
following keys to the configuration:
5835

59-
These defaults can be (selectively) overridden through custom
60-
`:duct.database/sql` (or `:duct.database.sql/hikaricp`) and
61-
`:duct.migrator/ragtime` keys in your duct profiles.
36+
* `:duct.database.sql/hikaricp` - a SQL datasource
37+
* `:duct.migrator/ragtime` - applies database migrations
6238

63-
`URL` is either overridden, set by the `:database-url` module parameter
64-
or provided by the `JDBC_DATABASE_URL` and `DATABASE_URL` environment
65-
variables, in this order.
39+
This will setup a pooled database connection and a migrator that looks
40+
for a file `migrations.edn` in the current directory. See the
41+
documentation on [Ragtime's SQL migrations][migrations] for information
42+
about the syntax.
6643

67-
`STRATEGY` is `:raise-error` for `:production` environment,
68-
`:rebase` for `:development`.
44+
The JDBC URL is supplied via the `jdbc-url` var. This can be set via the
45+
`--jdbc-url` command line argument of duct.main, or using the
46+
`JDBC_DATABASE_URL` environment variable.
6947

70-
##### Key Documentation:
48+
In the `:main` profile, the Ragtime migration strategy is set to
49+
`:raise-error`, which will raise an error if there's a conflict. In the
50+
`:repl` profile, the migration strategy is set to `:rebase`, which will
51+
attempt to roll back migrations to the conflict, then reapply them all.
7152

72-
* [database.sql.hikaricp](https://github.com/duct-framework/database.sql.hikaricp)
73-
* [migrator.ragtime](https://github.com/duct-framework/migrator.ragtime)
53+
[expand]: https://github.com/weavejester/integrant#expanding
54+
[migrations]: https://github.com/weavejester/ragtime/wiki/SQL-Migrations#edn
7455

7556
## License
7657

0 commit comments

Comments
 (0)