mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 03:07:47 +00:00
Update SQL comments
This commit is contained in:
@@ -248,7 +248,7 @@ RETURNS TABLE (
|
|||||||
) AS $$
|
) AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Aggregate all metrics as trip ios short.
|
-- Aggregate all metrics as trip is short.
|
||||||
RETURN QUERY
|
RETURN QUERY
|
||||||
WITH metrics AS (
|
WITH metrics AS (
|
||||||
-- Extract metrics
|
-- Extract metrics
|
||||||
|
@@ -17,19 +17,21 @@ select current_database();
|
|||||||
\echo 'Force timezone, just in case'
|
\echo 'Force timezone, just in case'
|
||||||
set timezone to 'UTC';
|
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';
|
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';
|
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;
|
ALTER TABLE api.metadata ALTER COLUMN "configuration" TYPE jsonb USING "configuration"::jsonb;
|
||||||
COMMENT ON COLUMN api.metadata.configuration IS 'Signalk path mapping for metrics';
|
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;
|
ALTER TABLE api.metadata ADD available_keys jsonb NULL;
|
||||||
COMMENT ON COLUMN api.metadata.available_keys IS 'Signalk paths with unit for custom mapping';
|
COMMENT ON COLUMN api.metadata.available_keys IS 'Signalk paths with unit for custom mapping';
|
||||||
|
|
||||||
--DROP FUNCTION public.metadata_upsert_trigger_fn();
|
--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()
|
CREATE OR REPLACE FUNCTION public.metadata_upsert_trigger_fn()
|
||||||
RETURNS trigger
|
RETURNS trigger
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
@@ -92,6 +94,7 @@ $function$
|
|||||||
COMMENT ON FUNCTION public.metadata_upsert_trigger_fn() IS 'process metadata from vessel, upsert';
|
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
|
-- 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()
|
CREATE OR REPLACE FUNCTION api.update_metadata_configuration()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -118,7 +121,7 @@ BEFORE UPDATE ON api.metadata
|
|||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
EXECUTE FUNCTION api.update_metadata_configuration();
|
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(
|
CREATE OR REPLACE FUNCTION api.export_logbooks_geojson_linestring_trips_fn(
|
||||||
start_log integer DEFAULT NULL::integer,
|
start_log integer DEFAULT NULL::integer,
|
||||||
end_log integer DEFAULT NULL::integer,
|
end_log integer DEFAULT NULL::integer,
|
||||||
|
@@ -123,7 +123,7 @@ $function$;
|
|||||||
-- Description
|
-- Description
|
||||||
COMMENT ON FUNCTION api.export_logbooks_geojson_linestring_trips_fn IS 'Generate geojson geometry LineString from trip with the corresponding properties';
|
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()
|
CREATE OR REPLACE FUNCTION public.check_jwt()
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
@@ -998,7 +998,7 @@ COMMENT ON VIEW
|
|||||||
api.monitoring_view
|
api.monitoring_view
|
||||||
IS 'Monitoring static web 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;
|
DROP VIEW IF EXISTS api.monitoring_live;
|
||||||
CREATE or replace VIEW api.monitoring_live WITH (security_invoker=true,security_barrier=true) AS
|
CREATE or replace VIEW api.monitoring_live WITH (security_invoker=true,security_barrier=true) AS
|
||||||
SELECT
|
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.stay_active_geojson_fn to grafana;
|
||||||
GRANT EXECUTE ON FUNCTION public.logbook_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 version
|
||||||
UPDATE public.app_settings
|
UPDATE public.app_settings
|
||||||
SET value='0.9.1'
|
SET value='0.9.1'
|
||||||
|
Reference in New Issue
Block a user