This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
Set remove_date when creating plantings according to its life_cycle. #1334
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Set remove_date automatically according to the plants life cycle. The code is ok but it may be better to change the data type of
life_cycles
ofplants
in the db.Option<Vec<Option<LifeCycle>>>
is such a ridiculous type, it should beVec<LifeCycle>
ifLifeCycle
is not enough, or if we prefer nullable (It's a different debate whether nullable strings and lists make sense ever) It can beOption<Vec<LifeCycle>>
.We may want to consider in the database:
ife_cycles life_cycle[] NOT NULL DEFAULT ARRAY[]::life_cycle[]
and
ALTER TABLE plants ADD CONSTRAINT no_null_life_cycles CHECK (NOT ARRAY[NULL] <@ life_cycles);
(If there is no logic reason it be very to create a migration that just the longest life_cycle per plant)
Basics
close #X
, are in the commit messages and changelogChecklist
First Time Checklist
Review