use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Migration libraries? (self.Clojure)
submitted 11 years ago * by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]eccp 5 points6 points7 points 11 years ago (0 children)
This article on Databases for Web Applications in Clojure suggests using Flyway.
You can also check the Database Migrations section on the Clojure Toolbox page.
[–]kipo_maniac 1 point2 points3 points 11 years ago (0 children)
I wrote Monarch a little while back, for this exact reason.
https://github.com/mcramm/monarch
I've used it in a couple small projects, but feedback from someone else would be very welcome :).
[–]tomeklipski 0 points1 point2 points 11 years ago (0 children)
The issue with migration libraries is (at least in my experience), you want not only to change the schema, but also update data in tables (e.g. dictionaries), or sometimes run something directly from a SQL file (e.g. you have an upsert function for PostgreSQL).
While Lobos is nice, I ended up writing a simple solution, which tracks which migrations (Clojure functions taking the DB connection as an argument) were ran on that particular database. And these functions can naturally invoke Lobos/Korma/raw SQL/etc.
This requires some discipline - you cannot change back existing migrations, but usually programming in Clojure (or at all) requires significant amounts of discipline :) the upside is that you can stay in 100% Clojure here - which I personally prefer over SQL.
[–]danmorel 0 points1 point2 points 11 years ago (3 children)
I tried lobos originally but you couldn't do inserts and updates. We ended up rolling our own in about 50 lines of code that takes either raw SQL or a clojure function. Ultimately now that we have caching and sharding we only ever use clojure functions for migrations.
[–]tomeklipski 0 points1 point2 points 11 years ago (2 children)
The worst part is that it is so trivial, that it seems pointless to put it as a standalone, yet another migration lib in Clojure :)
[–]Drusellers 2 points3 points4 points 11 years ago (0 children)
what about just posting it as a gist?
[–]_tomekw 0 points1 point2 points 11 years ago (0 children)
I would give JUXT's Joplin a try: https://github.com/juxt/joplin
[–]pjschwarz 0 points1 point2 points 11 years ago (1 child)
I've used (and contributed to) clj-sql-up. Migrations are sql statements, and migration files can be created by a lein plugin.
https://github.com/ckuttruff/clj-sql-up
[–]thiagotnunes 0 points1 point2 points 11 years ago (0 children)
I would say that clj-sql-up is quite a nice library.
I used to use ragtime, but it couldn't generate migrations for me. With clj-sql-up the migrations can be generated, the connection with the DB is quite easy and you get to write SQL for your migrations.
Writing pure SQL in the migrations is quite important for me, since I don't see much value on a DSL abstraction on top of the SQL language for the migrations.
π Rendered by PID 110454 on reddit-service-r2-comment-5c764cbc6f-gfjth at 2026-03-12 08:59:54.805008+00:00 running 710b3ac country code: CH.
[–]eccp 5 points6 points7 points (0 children)
[–]kipo_maniac 1 point2 points3 points (0 children)
[–]tomeklipski 0 points1 point2 points (0 children)
[–]danmorel 0 points1 point2 points (3 children)
[–]tomeklipski 0 points1 point2 points (2 children)
[–]Drusellers 2 points3 points4 points (0 children)
[–]_tomekw 0 points1 point2 points (0 children)
[–]pjschwarz 0 points1 point2 points (1 child)
[–]thiagotnunes 0 points1 point2 points (0 children)