Update SQL comments

This commit is contained in:
xbgmsharp
2025-05-04 22:32:42 +02:00
parent 861e61d378
commit 29cc40f6de
3 changed files with 10 additions and 14 deletions

View File

@@ -248,7 +248,7 @@ RETURNS TABLE (
) AS $$
DECLARE
BEGIN
-- Aggregate all metrics as trip ios short.
-- Aggregate all metrics as trip is short.
RETURN QUERY
WITH metrics AS (
-- Extract metrics

View File

@@ -17,19 +17,21 @@ select current_database();
\echo 'Force timezone, just in case'
set timezone to 'UTC';
-- Mark client_id as deprecated
-- Update metadata table, mark client_id as deprecated
COMMENT ON COLUMN api.metadata.client_id IS 'Deprecated client_id to be removed';
-- Update metrics table, mark client_id as deprecated
COMMENT ON COLUMN api.metrics.client_id IS 'Deprecated client_id to be removed';
-- Update metadata table COLUMN type to jsonb
-- Update metadata table update configuration column type to jsonb and comment
ALTER TABLE api.metadata ALTER COLUMN "configuration" TYPE jsonb USING "configuration"::jsonb;
COMMENT ON COLUMN api.metadata.configuration IS 'Signalk path mapping for metrics';
-- Add new column available_keys
-- Update metadata table add new column available_keys and comment
ALTER TABLE api.metadata ADD available_keys jsonb NULL;
COMMENT ON COLUMN api.metadata.available_keys IS 'Signalk paths with unit for custom mapping';
--DROP FUNCTION public.metadata_upsert_trigger_fn();
-- Update metadata_upsert_trigger_fn to metadata table to support configuration and available_keys and deprecated client_id
CREATE OR REPLACE FUNCTION public.metadata_upsert_trigger_fn()
RETURNS trigger
LANGUAGE plpgsql
@@ -92,6 +94,7 @@ $function$
COMMENT ON FUNCTION public.metadata_upsert_trigger_fn() IS 'process metadata from vessel, upsert';
-- Create or replace the function that will be executed by the trigger
-- Add metadata table trigger for update_metadata_configuration
CREATE OR REPLACE FUNCTION api.update_metadata_configuration()
RETURNS TRIGGER AS $$
BEGIN
@@ -118,7 +121,7 @@ BEFORE UPDATE ON api.metadata
FOR EACH ROW
EXECUTE FUNCTION api.update_metadata_configuration();
-- Update api.export_logbook_geojson_linestring_trip_fn, add metadata
-- Update api.export_logbook_geojson_linestring_trip_fn, add metadata properties
CREATE OR REPLACE FUNCTION api.export_logbooks_geojson_linestring_trips_fn(
start_log integer DEFAULT NULL::integer,
end_log integer DEFAULT NULL::integer,

View File

@@ -123,7 +123,7 @@ $function$;
-- Description
COMMENT ON FUNCTION api.export_logbooks_geojson_linestring_trips_fn IS 'Generate geojson geometry LineString from trip with the corresponding properties';
-- Updaste public.check_jwt, Make new mobilitydb export geojson function anonymous access
-- Update public.check_jwt, Make new mobilitydb export geojson function anonymous access
CREATE OR REPLACE FUNCTION public.check_jwt()
RETURNS void
LANGUAGE plpgsql
@@ -998,7 +998,7 @@ COMMENT ON VIEW
api.monitoring_view
IS 'Monitoring static web view';
-- api.monitoring_live view, the live tracking view
-- Add api.monitoring_live view, the live tracking view
DROP VIEW IF EXISTS api.monitoring_live;
CREATE or replace VIEW api.monitoring_live WITH (security_invoker=true,security_barrier=true) AS
SELECT
@@ -1141,13 +1141,6 @@ GRANT EXECUTE ON FUNCTION public.logbook_active_geojson_fn to api_anonymous;
GRANT EXECUTE ON FUNCTION public.stay_active_geojson_fn to grafana;
GRANT EXECUTE ON FUNCTION public.logbook_active_geojson_fn to grafana;
-- TODO
-- DELETE all unused public.logbook_backup column to keep id, vessel_id, trip and embeding_*
-- UPDATE Delete/desactivated function accordingly
-- Run 99_migrations_202504.sql full to update version get new trigger
-- Run this migration 99_migrations_202505.sql full to update version.
-- Solve issue with update trip trigger
-- Update version
UPDATE public.app_settings
SET value='0.9.1'