3liz / qgis-pgmetadata-plugin

QGIS Plugin to manage some metadata from PostgreSQL layer
GNU General Public License v2.0
12 stars 10 forks source link

Project - Add a default value for date when editing a metadata feature #77

Closed Gustry closed 2 years ago

Gustry commented 3 years ago
  1. I find it strange that it wasn't there before, why ?
  2. Something changed according to #75 that we can't save the metadata anymore ?
mdouchin commented 3 years ago

The default value is set database-side with now() https://docs.3liz.org/qgis-pgmetadata-plugin/database/tables/dataset.html which is enough for creation.

I am not against enforcing this default value on creation for creation_date and also on modification for update_date in the QGIS layer properties, but indeed we should also enforce the update of the update_date on a dataset UPDATE by modifying the trigger function calculate_fields_from_data and add

    -- Date fields
    NEW.update_date = now();
    IF TG_OP = 'INSERT' THEN
        NEW.creation_date = now();
    END IF;

before the comment -- Get table feature count

Gustry commented 2 years ago

Fixed in SQL as well @mdouchin

I have added tests (fixed the DCAT as well because of this update).

I'm fine to merge this PR after 1.1.0 if needed.