diff options
-rw-r--r-- | README.org | 10 | ||||
-rwxr-xr-x | dump.scm | 37 |
2 files changed, 24 insertions, 23 deletions
@@ -22,15 +22,15 @@ brackets with the appropriate values. (port . <port-here>)) #+END_SRC -Then, to dump the database, run +Then, to dump the database to ~/data/dump, run #+BEGIN_SRC shell - $ ./pre-inst-env ./dump.scm + $ ./pre-inst-env ./dump.scm conn.scm ~/data/dump #+END_SRC -The database will be dumped to ~/data/dump/. Make sure there is enough -free space! It's best to dump the database on penguin2 where disk -space and bandwidth are not significant constraints. +Make sure there is enough free space! It's best to dump the database +on penguin2 where disk space and bandwidth are not significant +constraints. * Contributing @@ -1,7 +1,8 @@ #! /usr/bin/env guile !# -(use-modules (rnrs io ports) +(use-modules (rnrs programs) + (rnrs io ports) (srfi srfi-1) (srfi srfi-26) (ice-9 match) @@ -13,25 +14,24 @@ ;;; GeneNetwork database connection parameters and dump path +(define %connection-settings + (call-with-input-file (list-ref (command-line) 0) + read)) + (define (call-with-genenetwork-database proc) - (let ((connection-settings (call-with-input-file "conn.scm" read))) - (call-with-database "mysql" (string-join - (list (assq-ref connection-settings 'username) - (assq-ref connection-settings 'password) - (assq-ref connection-settings 'database) - "tcp" - (assq-ref connection-settings 'host) - (number->string - (assq-ref connection-settings 'port))) - ":") - proc))) - -(define %database-name - (assq-ref (call-with-input-file "conn.scm" read) - 'database)) + (call-with-database "mysql" (string-join + (list (assq-ref %connection-settings 'username) + (assq-ref %connection-settings 'password) + (assq-ref %connection-settings 'database) + "tcp" + (assq-ref %connection-settings 'host) + (number->string + (assq-ref %connection-settings 'port))) + ":") + proc)) (define %dump-directory - (string-append (getenv "HOME") "/data/dump")) + (list-ref (command-line) 1)) (define (call-with-dump-file filename proc) (let ((absolute-path (string-append %dump-directory filename))) @@ -717,7 +717,8 @@ is a <table> object." (select-query ((information_schema.tables table_name) (information_schema.tables data_length)) (information_schema.tables) - (format #f "WHERE table_schema = '~a'" %database-name))))) + (format #f "WHERE table_schema = '~a'" + (assq-ref %connection-settings 'database)))))) (define (dump-schema db) (let ((tables (tables db))) |