Skip to content

Instantly share code, notes, and snippets.

@certainty
Created December 26, 2010 15:21
Show Gist options
  • Save certainty/755470 to your computer and use it in GitHub Desktop.
Save certainty/755470 to your computer and use it in GitHub Desktop.
nomads
(use nomads nomads-sql-de-lite fmt fmt-color filepath)
(migration-directory "./migrations")
(database-credentials "test.db")
(define (get-version)
(let ((version (get-environment-variable "VERSION")))
(if version
(or (string->number version) (string->symbol version))
'latest)))
(define (pretty-print-migration checkpoint irreversible?)
(let ((direction (car checkpoint))
(migration (cdr checkpoint)))
(fmt #t
(pad-char #\.
(cat "["
(fmt-bold (migration-version migration))
"] "
(filepath:drop-extension (migration-filename migration))
" "
(space-to 72)
"["
(fmt-bold (if irreversible? (fmt-red "IRREVERSIBLE") (fmt-green "OK")))
"]")))
(newline)))
(migrate version: (get-version) callback: pretty-print-migration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment