(index ("database-credentials" 0) ("migration-directory" 318) ("error-on-duplicate-migrations" 598) ("error-on-non-existent-migration" 817) ("filename-pattern" 1106) ("filename-partitioner" 1106) ("filename-joiner" 1106) ("versioner" 1106) ("version?" 1106) ("version-less?" 1106) ("version-equal?" 1106) ("version->string" 1106) ("string->version" 1106) ("generate-migration" 2538) ("migrate" 2790))
(def (sig (parameter "database-credentials" (id database-credentials))) (p "Depending on the database-binding you use, this holds the connection-specification that will be passed to the binding's connect-procedure. See the documentation for " (int-link "sql-de-lite") " and " (int-link "postgresql") " for details."))
(def (sig (parameter "migration-directory" (id migration-directory))) (p "As the name suggests this parameter specifies where migration files can be found. If this is a relative pathname it will be interpreted relative to the directory in which the configuration file resides."))
(def (sig (parameter "error-on-duplicate-migrations" (id error-on-duplicate-migrations))) (p "If this parameter is set to " (tt "#t") " (the default) a condition of kind (nomads-error duplicate-version) is signaled."))
(def (sig (parameter "error-on-non-existent-migration" (id error-on-non-existent-migration))) (p "If this parameter is set to " (tt "#t") " (the default) a condition of kind (nomads-error non-existent-version) is signaled, if somone attempts to migrate to a version that doesn't exist."))
(def (sig (parameter "filename-pattern" (id filename-pattern)) (parameter "filename-partitioner" (id filename-partitioner)) (parameter "filename-joiner" (id filename-joiner)) (parameter "versioner" (id versioner)) (parameter "version?" (id version?)) (parameter "version-less?" (id version-less?)) (parameter "version-equal?" (id version-equal?)) (parameter "version->string" (id version->string)) (parameter "string->version" (id string->version))) (p "The following example sets up a versioning scheme that uses timestamps") (highlight scheme "(use nomads nomads-sql-de-lite numbers)\n\n(versioner (lambda (max-version)\n            (inexact->exact (current-seconds))))\n\n(filename-partitioner      \n (lambda (filename)\n   (let ((parts (string-split filename \"-\")))\n     (cond\n      ((null? parts) (cons #f \"\"))\n      ((string->number (car parts))\n       => (lambda (num)\n            (cons (number->string (inexact->exact num)) (string-join (cdr parts) \"-\"))))\n      (else (cons #f filename))))))\n\n(filename-joiner           \n (lambda (version file)\n    (sprintf \"~A-~A\" version file)))\n\n ;;we need to bind it to the number's version of those\n(version? number?)\n\n(define (->number what)\n  (inexact->exact (if (string? what) (string->number what) what)))\n\n(version-less?\n (lambda (l r)\n   (< (->number l) (->number r))))\n\n(version-equal?\n (lambda (l r)\n   (equal? (->number l) (->number r))))"))
(def (sig (procedure "(generate-migration name)" (id generate-migration))) (p "The procedure generates a migration-stub inside " (tt "migration-directory") " with the given name. It returns the full name of the migration-file including the version."))
(def (sig (procedure "(migrate #!key (version 'latest) (callback default-callback))" (id migrate))) (p "This procedure starts the migration process. It migrates from the currently active version to " (tt "version") ". Depending on the active version the migrations run downwards or upwards executing the DOWN and UP portion of the files respectively. After each check-point (a single migration) " (tt "callback") " is invoked. If you do not specify this argument the " (tt "default-handler") " will just print which migration have been executed along with the status of their execution."))
