diff options
-rw-r--r-- | guix-data-service/model/utils.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/guix-data-service/model/utils.scm b/guix-data-service/model/utils.scm index 11916e8..3b256f1 100644 --- a/guix-data-service/model/utils.scm +++ b/guix-data-service/model/utils.scm @@ -114,6 +114,21 @@ '() lst)) +(define (table-schema conn table-name) + (map + (match-lambda + ((column_name data_type is_nullable) + (list column_name + data_type + (string=? is_nullable "YES")))) + (exec-query + conn + " +SELECT column_name, data_type, is_nullable +FROM information_schema.columns +WHERE table_name = $1" + (list table-name)))) + (define* (insert-missing-data-and-return-all-ids conn table-name |