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)

Source Descriptor is_coded.png​ (84.6 KB ) - added by Martin Reisinger 6 years ago.

Download all attachments as: .zip

Change History (5)

by Martin Reisinger, 6 years ago

comment:1 by Benjamin Haag, 6 years ago

Owner: changed from Kurt Admin to Benjamin Haag
Status: new → assigned

Reassigning -- appears to be DB change.

comment:2 by Benjamin Haag, 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 Benjamin Haag, 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 Benjamin Haag, 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.

Note: See TracTickets for help on using tickets.