diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-22 18:08:48 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-22 18:08:48 +0100 |
| commit | 09e2b04a7b469daa4b8b6fd89b88ae800d612fd6 (patch) | |
| tree | c42ba360b2894ffc39e5f6e19c6263d42b2ba42f /db | |
| parent | fc9f74466d0b56a089f8b6d8aed870e0b943f092 (diff) | |
Make fertilizer product brand name obligatory.
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations.rkt | 4 | ||||
| -rw-r--r-- | db/seed.rkt | 5 |
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 |