Changeset 21993 in project


Ignore:
Timestamp:
12/14/10 21:01:52 (9 years ago)
Author:
certainty
Message:

nomads: irreversible migrations can take an optional message now

Location:
release/4/nomads/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/nomads/trunk/nomads.scm

    r21562 r21993  
    33;;
    44;; Created: Do Nov 11 14:10:17 2010 (CET)
    5 ;; Last-Updated: Do Nov 18 19:52:26 2010 (CET)
     5;; Last-Updated: Di Dez 14 20:37:12 2010 (CET)
    66;;           By:
    77
     
    340340    ((db-with-transaction) db
    341341     (lambda ()
    342        (run-statements db stmts (lambda () (callback check-point #t) (exit #f)))
     342       (run-statements db stmts (lambda (#!optional (message ""))
     343                                  (callback check-point #t message)
     344                                  (exit #f)))
    343345       (finish-check-point db migration direction)))
    344346    (callback check-point #f)))
     
    361363     (cond
    362364      ((eq? stmt #f)     (irreversible))
     365      ((and (pair? stmt) (eq? (car stmt) #f) (string? (cdr stmt)))
     366       (irreversible (cdr stmt)))
    363367      ((procedure? stmt) (stmt db))
    364368      ((string? stmt)    ((db-execute-sql) db stmt))
  • release/4/nomads/trunk/tests/migrations/with-irreversible/4-irreversible-migration.scm

    r21450 r21993  
    33;;
    44;; Created: Sa Nov 13 08:53:50 2010 (CET)
    5 ;; Last-Updated: Sa Nov 13 08:54:01 2010 (CET)
     5;; Last-Updated: Di Dez 14 20:35:09 2010 (CET)
    66;;           By:
    77
     
    99  "INSERT INTO tests (version) VALUES(4)")
    1010 (DOWN
    11   #f))
     11  (#f .  "Testmessage")))
  • release/4/nomads/trunk/tests/run.scm

    r21538 r21993  
    33;;
    44;; Created: Do Nov 11 16:25:19 2010 (CET)
    5 ;; Last-Updated: Do Nov 18 19:36:32 2010 (CET)
     5;; Last-Updated: Di Dez 14 20:41:22 2010 (CET)
    66;;           By:
    77
     
    4444                                (db-latest-version db))))
    4545
    46 (define (test-migration to #!key (reset #f))
     46(define (test-migration to #!key (reset #f) (callback (lambda args #t)))
    4747  (initialize-test-db)
    4848  (if reset (reset-db))
    49   (migrate version: to callback: (lambda args #t))
     49  (migrate version: to callback: callback)
    5050  (latest-version)
    5151  (cons (latest-version) (fetch-versions)))
     
    152152                    (test-migration 'earliest)))
    153153
     154            (test "irreversible migrations with message"
     155                  "Testmessage"
     156                  (parameterize ((migration-directory "./migrations/with-irreversible"))
     157                    (test-migration 'latest reset: #t)
     158                    (let* ((msg "")
     159                           (cb (lambda (checkpoint irreversible? #!optional (message #f))
     160                                 (when irreversible?
     161                                   (set! msg message)))))
     162                      (migrate version:'earliest callback: cb)
     163                      msg)))
     164
    154165
    155166            (test "detect dublicate migrations"
Note: See TracChangeset for help on using the changeset viewer.