diff options
Diffstat (limited to 'dump/schema-dump.scm')
-rw-r--r-- | dump/schema-dump.scm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/dump/schema-dump.scm b/dump/schema-dump.scm index 86626f4..525bf65 100644 --- a/dump/schema-dump.scm +++ b/dump/schema-dump.scm @@ -7,7 +7,7 @@ #:use-module (dump table)) -(define (dump-table-fields db table) +(define (table-fields db table) (format #t "* ~a~%" table) (match (sql-find db (select-query ((TableComments Comment)) @@ -41,10 +41,10 @@ (select-query ((TableComments TableName)) (TableComments)))) -(define (dump-schema-annotations db) +(define (schema-annotations db) (call-with-target-database (lambda (db) - (for-each (cut dump-table-fields db <>) + (for-each (cut table-fields db <>) (get-tables-from-comments db))))) (define (tables db) @@ -70,7 +70,7 @@ is a <table> object." (format #f "WHERE table_schema = '~a'" (assq-ref %connection-settings 'sql-database)))))) -(define (dump-schema db) +(define (schema db) (let ((tables (tables db))) (for-each (lambda (table) (let ((table-id (string->identifier @@ -94,13 +94,13 @@ is a <table> object." (table-columns table)))) tables))) -(define* (dump-data-table db table-name data-field - #:optional (default-dump-directory "")) - (let ((dump-directory (string-append default-dump-directory "/" table-name)) +(define* (data-table db table-name data-field + #:optional (default-directory "")) + (let ((directory (string-append default-directory "/" table-name)) (port #f) (current-strain-id #f)) - (unless (file-exists? dump-directory) - (mkdir dump-directory)) + (unless (file-exists? directory) + (mkdir directory)) (sql-for-each (match-lambda (((_ . strain-id) (_ . value)) @@ -112,7 +112,7 @@ is a <table> object." ;; If no file is open, open new file. (unless port (set! current-strain-id strain-id) - (let ((filename (string-append dump-directory + (let ((filename (string-append directory "/" (number->string strain-id)))) (display filename (current-error-port)) (newline (current-error-port)) |