Open sjib opened 1 month ago
@sjib to do write concept for this as discussed
- Add MANDATORY constraint to datamodel @sjib
I saw that we also do not have MANDATORY constraints in the postgres data model of tww - discuss with Technical group
- Implement trigger in forms, that fill in Name_Number = obj_id if no Name_Number is added - see TWW implementation (to do add link @sjib)
@urskaufmann How and where did we add this in tww? In the project file or as trigger in the database?
Name_Nummer (=Identifier) is in tww normally not defined in the project. There must be somewhere a trigger, that sets identifier = obj_id as default value. With one exception: all identifier (reach, channel, reachpoint) in vw_tww_reach do not work like this, there has to be the obj_id defined as default value. The vw_tww_reach is somewhere specially, it's to only view, where the QGIS-standard-"reuse last value" does not work...
These triggers seem to be created here in tww: https://github.com/teksi/wastewater/blob/d8a3e3a8f92be62848dfc465c6cba45b824467ca/datamodel/app/view/vw_tww_wastewater_structure.py#L277
In the final database it then looks like this:
NEW.identifier = COALESCE(NEW.identifier, NEW.obj_id);
And for cover:
, CASE WHEN NEW.identifier IS NOT NULL AND NEW.identifier::text <> '' THEN NEW.identifier ELSE COALESCE( NEW.obj_id, tww_sys.generate_oid('tww_od'::text, 'structure_part'::text) ) END
@urskaufmann In vw_tww_reach there is nothing defined for NEW wwn.identifier - may be that is the reason:
Name_Nummer (name_number) – in INTERLIS not MANDATORY – how to handle in TEKSI Distance heating? I would suggest to set it MANDATORY