From 09e2b04a7b469daa4b8b6fd89b88ae800d612fd6 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sat, 22 Nov 2025 18:08:48 +0100 Subject: Make fertilizer product brand name obligatory. --- db/migrations.rkt | 4 ++-- db/seed.rkt | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'db') 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 -- cgit v1.2.3