Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

api.stays_explore_view

Description

List moorages notes order by stays

Table Definition
CREATE VIEW stays_explore_view AS (
 SELECT s.id AS stay_id,
    m.id AS moorage_id,
    m.name AS moorage_name,
    s.name AS stay_name,
    s.arrived,
    s.stay_code,
    s.latitude,
    s.longitude,
    s.notes AS stay_notes,
    m.notes AS moorage_notes,
        CASE
            WHEN (jsonb_array_length((s.user_data -> 'images'::text)) > 0) THEN true
            ELSE false
        END AS has_images,
    (s.user_data -> 'images'::text) AS images,
    s.id,
    s.name
   FROM (api.stays s
     LEFT JOIN api.moorages m ON ((s.moorage_id = m.id)))
  ORDER BY s.arrived DESC
)

Columns

NameTypeDefaultNullable
arrivedtimestamp with time zonetrue
has_imagesbooleantrue
idintegertrue
imagesjsonbtrue
latitudedouble precisiontrue
longitudedouble precisiontrue
moorage_idintegertrue
moorage_nametexttrue
moorage_notestexttrue
nametexttrue
stay_codeintegertrue
stay_idintegertrue
stay_nametexttrue
stay_notestexttrue

Referenced Tables

NameColumnsCommentType
api.stays15The stays table records time spent at moorages. Each stay links a moorage with arrival/departure timestamps. RLS policies filter by vessel_id.BASE TABLE
api.moorages14The moorages table stores locations where vessels can stay (marinas, anchorages, etc.). Each moorage has geographic coordinates and metadata.BASE TABLE

Relations

erDiagram


"api.stays_explore_view" {
  timestamp_with_time_zone arrived ""
  boolean has_images ""
  integer id ""
  jsonb images ""
  double_precision latitude ""
  double_precision longitude ""
  integer moorage_id ""
  text moorage_name ""
  text moorage_notes ""
  text name ""
  integer stay_code ""
  integer stay_id ""
  text stay_name ""
  text stay_notes ""
}

Generated by tbls