Skip to content

Commit 8756641

Browse files
committed
Update module.sql version in examples to 0.9.0
1 parent 0424647 commit 8756641

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

index.adoc

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ Our project dependencies should now look like this:
11031103
org.duct-framework/main {:mvn/version "0.3.0"}
11041104
org.duct-framework/module.logging {:mvn/version "0.6.6"}
11051105
org.duct-framework/module.web {:mvn/version "0.13.2"}
1106-
org.duct-framework/module.sql {:mvn/version "0.8.1"}
1106+
org.duct-framework/module.sql {:mvn/version "0.9.0"}
11071107
org.xerial/sqlite-jdbc {:mvn/version "3.50.3.0"}
11081108
com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"}}
11091109
:aliases {:duct {:main-opts ["-m" "duct.main"]}}}
@@ -1233,12 +1233,32 @@ a migration.
12331233

12341234
=== SQL Migrations
12351235

1236-
Part of the SQL module is to add a **migrator**, a component that will
1237-
manage database migrations. By default the
1238-
https://github.com/weavejester/ragtime[Ragtime] library is used, and
1239-
looks for a `migrations.edn` file in your project directory.
1236+
One of the things the SQL module adds is a **migrator**, a component
1237+
that will manage database migrations. By default the
1238+
https://github.com/weavejester/ragtime[Ragtime] migration library is
1239+
used.
12401240

1241-
Let's create a migration for a table to store the todo list items.
1241+
The migrations are supplied via the `:migrations` key on the module. As
1242+
there may be many migrations, it's worth separating these out into their
1243+
own file via the `#duct/include` tag.
1244+
1245+
.duct.edn
1246+
[,clojure]
1247+
----
1248+
{:vars {jdbc-url {:default "jdbc:sqlite:todo.db"}}
1249+
:system
1250+
{:duct.module/logging {}
1251+
:duct.module/sql
1252+
{:migrations #duct/include "migrations.edn"}
1253+
:duct.module/web
1254+
{:features #{:site :hiccup}
1255+
:handler-opts {:db #ig/ref :duct.database/sql}
1256+
:routes [["/" {:get :todo.routes/index}]]}}}
1257+
----
1258+
1259+
In the above case, we've separated out the migrations into the
1260+
`migrations.edn` file. Let's add a migration to this file that will
1261+
create a table to store the todo list items.
12421262

12431263
.migrations.edn
12441264
[,clojure]
@@ -1348,7 +1368,8 @@ the POST.
13481368
{:vars {jdbc-url {:default "jdbc:sqlite:todo.db"}}
13491369
:system
13501370
{:duct.module/logging {}
1351-
:duct.module/sql {}
1371+
:duct.module/sql
1372+
{:migrations #duct/include "migrations.edn"}
13521373
:duct.module/web
13531374
{:features #{:site :hiccup}
13541375
:handler-opts {:db #ig/ref :duct.database/sql}
@@ -1427,7 +1448,7 @@ ClojureScript. As always we begin with our dependencies, and add the
14271448
org.duct-framework/module.cljs {:mvn/version "0.5.2"}
14281449
org.duct-framework/module.logging {:mvn/version "0.6.6"}
14291450
org.duct-framework/module.web {:mvn/version "0.13.2"}
1430-
org.duct-framework/module.sql {:mvn/version "0.8.1"}
1451+
org.duct-framework/module.sql {:mvn/version "0.9.0"}
14311452
org.xerial/sqlite-jdbc {:mvn/version "3.50.3.0"}
14321453
com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"}}
14331454
:aliases {:duct {:main-opts ["-m" "duct.main"]}}}
@@ -1445,7 +1466,8 @@ configuration file.
14451466
{:vars {jdbc-url {:default "jdbc:sqlite:todo.db"}}
14461467
:system
14471468
{:duct.module/logging {}
1448-
:duct.module/sql {}
1469+
:duct.module/sql
1470+
{:migrations #duct/include "migrations.edn"}
14491471
:duct.module/cljs
14501472
{:builds {:client todo.client}}
14511473
:duct.module/web
@@ -1535,7 +1557,8 @@ to communicate with the server.
15351557
{:vars {jdbc-url {:default "jdbc:sqlite:todo.db"}}
15361558
:system
15371559
{:duct.module/logging {}
1538-
:duct.module/sql {}
1560+
:duct.module/sql
1561+
{:migrations #duct/include "migrations.edn"}
15391562
:duct.module/cljs {:builds {:client todo.client}}
15401563
:duct.module/web
15411564
{:features #{:site :api}
@@ -1633,7 +1656,7 @@ This requires us to once again update the project dependencies:
16331656
org.duct-framework/module.cljs {:mvn/version "0.5.2"}
16341657
org.duct-framework/module.logging {:mvn/version "0.6.6"}
16351658
org.duct-framework/module.web {:mvn/version "0.13.2"}
1636-
org.duct-framework/module.sql {:mvn/version "0.8.1"}
1659+
org.duct-framework/module.sql {:mvn/version "0.9.0"}
16371660
org.xerial/sqlite-jdbc {:mvn/version "3.50.3.0"}
16381661
com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"}
16391662
no.cjohansen/replicant {:mvn/version "2025.06.21"}}

0 commit comments

Comments
 (0)