table geofences:
    sequential_id: it cant be modified
    identifier: varchar 10 (identificador de eurocae) 
    layer_name: if the layer is not in the list, back would create a new layer. the list available is {DenselyPopulatedRegion, power_plant_volume, protected_zone_volume, schools_volume, townhall_volume, natural_zone_volume, hospitals_volume, TemporartFlightRestriction, aerodromes_volume, Emergency, aerodromes_volume, ControlledAirspace, rail_station_volume, SpecialUseAirspace, military_volume, generator_volume}
    geom_buffer: multipolygon
    name_feature: name of feature (varchar(50))
    lower_limit: int, si es null significa tierra
    upper_limit: int, si es null significa limite infinito
    lower_vertical_reference: one between AGL AMSL WGS84
    upper_vertical_reference: one between AGL AMSL WGS84
    geom_center: GeometryCollection
    geom_radius: int, if negative line buffer if positive, it is the radious of a circle
    contact: only update in geofences created from osm, if you are creating one you cant insert this properties
    url: only update in geofences created from osm, if you are creating one you cant insert this properties
    oid: only update in geofences created from osm, if you are creating one you cant insert this properties
    country_id: varchar(3), from ISO 3166-1 alpha 3 
    region: int 
    restriction: json encode in base64 with this structure {"type": "code_restriction_type", "values": [{"restriction_type_name": "REQ_AUTHORISATION"}, {"restriction_type_name": "CONDITIONAL", "conditions": [{"condition_name": "Manual authorization required from XXX"}, {"condition_name": "Allowed Operators/drones"}]}]}
    code_zone_reason: json encode in base64 with this structure {"type": "code_zone_reason", "values": [{"code_zone_type_name": "Population"}, {"code_zone_type_name": "Nature"}, {"code_zone_type_name": "Noise"}]}
    code_uspace_class_type: json encode in base64 with this structure {"type": "code_uspace_class_type", "values": [{"uspace_class_type_name": "NDZ"}, {"uspace_class_type_name": "EDZp"}]}
    volume_limitations: json encode in base64 with this structure {"type": "volume_limitation", "values": [{"volume_limitation_name": "Certification Type 0"}, {"volume_limitation_name": "Certification Type 3"}, {"volume_limitation_name": "Operation_type Specific"}]}
    code_zone_type: one between this list {COMMON, CUSTOMIZED, MODIFIED}
    time_period: json encode in base64 with this structure '{"type": "time_period", "values": [{"start_date": "2020-06-20 00:00:00+01", "end_date": "2055-06-26 00:00:00+01 ", "permanent": true, "daily_periods": [{"start_time": "12:00:00+01", "end_time": "12:00:00+01", "week_day": "Fryday"}]}]}'
    message: varchar(1000), alert message
    data_capture_prohibition: bool
    author_metadata: varchar(250), name of metadata
    intervalbefore: varchar 11
    remote_id: cant be modified directly, it has to be done by restriction property
    geoawareness_required: cant be modified directly, it has to be done by restriction property
    creation_datatime: timestamp with timezone
    update_datetime: it cant be modified directly, when any change is done the update_datetime is changed to current time.
    authorityfrom: json encode in base64 with the structure   {"type": "authorityfrom", "name": "name of authority", 'service', "authority.service", 'contact_name', "authority.contact_name", 'site_url', "authority.site_url", 'email', "authority.email", 'phone', "authority.phone" }
    notificationto: json encode in base64 with this structure {"type": "notificationto", "name": "name of authority", 'service', "authority.service", 'contact_name', "authority.contact_name", 'site_url', "authority.site_url", 'email', "authority.email", 'phone', "authority.phone" }


Ejemplo:

UPDATE geofences 
SET 
identifier = 'example', 
layer_name = 'schools_volume', 
geom_buffer = ST_GeomFromText(ST_AsEWKT(ST_GeomFromText('MULTIPOLYGON(((-2.8001205514147 37.8923252965836,-2.67564686446385 37.9656428983705,-2.72231818391457 37.8916144355108,-2.72428122429462 37.8879845103478, -2.70226559709314 37.8605123144506,-2.8001205514147 37.8923252965836)))',4326)::geography)),
name_feature = 'example change name',
lower_limit = 100,
upper_limit = 100,
lower_vertical_reference = 'AMSL',
upper_vertical_reference = 'AMSL',
geom_center = ST_GeomFromText(ST_AsEWKT(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(-1.15020589261845 38.4472871307411))',4326)::geography)),
geom_radius = 30,
contact = 'example',
url = 'https://es.wikipedia.org/wiki/ISO_3166-1',
oid = '66666555',
country_id = 'FRA',
region = 2, 
restriction = encode(convert_to('{"type": "code_restriction_type", "values": [{"restriction_type_name": "REQ_AUTHORISATION"}, {"restriction_type_name": "CONDITIONAL", "conditions": [{"condition_name": "Manual authorization required from XXX"}, {"condition_name": "Allowed Operators/drones"}]}]}', 'UTF-8'),'base64'),
code_zone_reason = encode(convert_to('{"type": "code_zone_reason", "values": [{"code_zone_type_name": "Population"}, {"code_zone_type_name": "Nature"}, {"code_zone_type_name": "Noise"}]}', 'UTF-8'),'base64'),
code_uspace_class_type = encode(convert_to('{"type": "code_uspace_class_type", "values": [{"uspace_class_type_name": "NDZ"}, {"uspace_class_type_name": "EDZp"}, {"uspace_class_type_name": "EDZm"}]}', 'UTF-8'),'base64'),
volume_limitations = encode(convert_to('{"type": "volume_limitation", "values": [{"volume_limitation_name": "Certification Type 0"}, {"volume_limitation_name": "Certification Type 3"}, {"volume_limitation_name": "Operation_type Specific"}]}', 'UTF-8'),'base64'), code_zone_type = 'CUSTOMIZED',message = 'example change message',data_capture_prohibition = True,author_metadata = 'author changed',intervalbefore = 'j97h86h99jh', creation_datetime = '2021-06-26 00:00:00+01', authorityfrom =  encode(convert_to('{"type": "authorityfrom", "name": "name of authority", "service": "exampleservice", "contact_name": "examplecontact_name", "site_url": "https://es.wikipedia.org/wiki/ISO_3166-1", "email": "email@email.com", "phone": "789456123" }', 'UTF-8'),'base64'), 
notificationto =  encode(convert_to('{"type": "notificationto", "name": "name of authority", "service": "exampleservice", "contact_name": "examplecontact_name", "site_url": "https://es.wikipedia.org/wiki/ISO_3166-1", "email": "email@email.com", "phone": "789456123" }', 'UTF-8'),'base64'), 
time_period =  encode(convert_to('{"type": "time_period", "values": [{"start_date": "2020-06-20 00:00:00+01", "end_date": "2055-06-26 00:00:00+01 ", "permanent": true, "daily_periods": [{"start_time": "12:00:00+01", "end_time": "12:00:00+01", "week_day": "Fryday"}]}]}', 'UTF-8'),'base64') 
WHERE sequential_id=5;



INSERT INTO geofences(
    identifier,layer_name,geom_buffer,name_feature,lower_limit,upper_limit,lower_vertical_reference,upper_vertical_reference,geom_center,geom_radius,
    country_id,region,restriction,code_zone_reason,code_uspace_class_type,volume_limitations,code_zone_type,
    message,data_capture_prohibition,author_metadata,intervalbefore,creation_datetime,authorityfrom,notificationto,time_period)
VALUES
(
    'example',
    'schools_volume',    
    ST_GeomFromText(ST_AsEWKT(ST_GeomFromText(\'MULTIPOLYGON(((-2.8001205514147 37.8923252965836,-2.67564686446385 37.9656428983705,-2.72231818391457 37.8916144355108,-2.72428122429462 37.8879845103478, -2.70226559709314 37.8605123144506,-2.8001205514147 37.8923252965836)))\',4326)::geography)),
    'example change name',   
    100,    
    100,    
    'AMSL',
    'AMSL',   
    ST_GeomFromText(ST_AsEWKT(ST_GeomFromText(\'GEOMETRYCOLLECTION(POINT(-1.15020589261845 38.4472871307411))\',4326)::geography)),    
    30,
    'FRA',
    2,    
    encode(convert_to('{"type": "code_restriction_type", "values": [{"restriction_type_name": "REQ_AUTHORISATION"}, {"restriction_type_name": "CONDITIONAL", "conditions": [{"condition_name": "Manual authorization required from XXX"}, {"condition_name": "Allowed Operators/drones"}]}]}', 'UTF-8'),'base64'),   
    encode(convert_to('{"type": "code_zone_reason", "values": [{"code_zone_type_name": "Population"}, {"code_zone_type_name": "Nature"}, {"code_zone_type_name": "Noise"}]}', 'UTF-8'),'base64'),
    encode(convert_to('{"type": "code_uspace_class_type", "values": [{"uspace_class_type_name": "NDZ"}, {"uspace_class_type_name": "EDZp"}]}', 'UTF-8'),'base64'),
    encode(convert_to('{"type": "volume_limitation", "values": [{"volume_limitation_name": "Certification Type 0"}, {"volume_limitation_name": "Certification Type 3"}, {"volume_limitation_name": "Operation_type Specific"}]}', 'UTF-8'),'base64'),
    'CUSTOMIZED',   
    'example change message',
    True,
    'author changed',
    'ljgh\',
    '2021-06-26 00:00:00+01',
    encode(convert_to('{"type": "authorityfrom", "name": "name of authority", "service": "exampleservice", "contact_name": "examplecontact_name", "site_url": "https://es.wikipedia.org/wiki/ISO_3166-1", "email": "email@email.com", "phone": "789456123" }', 'UTF-8'),'base64'),
    encode(convert_to(\'{"type": "notificationto", "name": "name of authority", "service": "exampleservice", "contact_name": "examplecontact_name", "site_url": "https://es.wikipedia.org/wiki/ISO_3166-1", "email": "email@email.com", "phone": "789456123" }', 'UTF-8'),'base64'),
    encode(convert_to('{"type": "time_period", "values": [{"start_date": "2020-06-20 00:00:00+01", "end_date": "2055-06-26 00:00:00+01 ", "permanent": true, "daily_periods": [{"start_time": "12:00:00+01", "end_time": "12:00:00+01", "week_day": "Fryday"}]}]}', 'UTF-8'),'base64')
)