summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrations.rkt4
-rw-r--r--db/seed.rkt5
2 files changed, 3 insertions, 6 deletions
diff --git a/db/migrations.rkt b/db/migrations.rkt
index 4007db4..0147210 100644
--- a/db/migrations.rkt
+++ b/db/migrations.rkt
@@ -154,9 +154,9 @@
(list (create-table #:if-not-exists fertilizer_products
#:columns [id integer #:not-null]
[canonical_name text #:not-null]
- [brand_name text]
+ [brand_name text #:not-null]
#:constraints (primary-key id)
- (unique canonical_name))))
+ (unique canonical_name brand_name))))
(module+ test
(connect!)
diff --git a/db/seed.rkt b/db/seed.rkt
index 0284bec..2d9f00b 100644
--- a/db/seed.rkt
+++ b/db/seed.rkt
@@ -99,10 +99,7 @@
(define n (get-nutrient #:formula (car fertilizer-component)))
(define v (string->number (cdr fertilizer-component)))
(values n v)))
- (cond
- [(non-empty-string? brand-name)
- (create-fertilizer-product! canonical-name nutrient-values brand-name)]
- [else (create-fertilizer-product! canonical-name nutrient-values)]))
+ (create-fertilizer-product! canonical-name brand-name nutrient-values))
(with-tx (csv-for-each row->seed! next-row)))
(define seed-sequence
Copyright 2019--2026 Marius PETER