Opened 6 years ago
Last modified 6 years ago
#2292 assigned defect
Source Habitat Descriptor Must be Coded to be Initially Saved
| Reported by: | Martin Reisinger | Owned by: | Benjamin Haag |
|---|---|---|---|
| Priority: | medium | Milestone: | |
| Component: | Database, Schema Changes | Version: | N/A |
| Severity: | Keywords: | ||
| Cc: | Database Engine: | N/A | |
| Operating System: | N/A |
Description
User must save all SH Descriptors as ccoded and then can edit after the intial save.
the source_descriptor is_coded field has a default of {DBNull.Value}.
Attachments (1)
Change History (5)
by , 6 years ago
| Attachment: | Source Descriptor is_coded.png added |
|---|
comment:1 by , 6 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 6 years ago
Recommendation:
1)Add BEFORE INSERT trigger to ensure that any lowercase "y" or "n" values are converted to upper case.
2) Add CHECK constraint to ensure that only "Y" or "N" are allowed.
These measure should be applied to all DB columns that use "Y" or "N".
comment:3 by , 6 years ago
Implemented the following constraint on dev:
ALTER TABLE source_descriptor WITH CHECK
ADD CONSTRAINT ck_is_coded CHECK (is_coded IN ('Y', 'N'))
comment:4 by , 6 years ago
Implemented corrected/improved CHECK constraint:
ALTER TABLE source_descriptor WITH CHECK ADD CONSTRAINT ck_is_coded_uppercase
CHECK (ASCII(is_coded) IN(ASCII('Y'),ASCII('N')) OR is_coded IS NULL);
1) Correctly enforces case as well as allowed values
2) Enables the immediate implementation of constraint despite existing incorrect data; this allows a systematic correction.

Reassigning -- appears to be DB change.