|
| 1 | +-- Add dimension flag columns to recreation_asset_code |
| 2 | +-- These boolean flags indicate which dimension measurements are applicable |
| 3 | +-- for a given asset type, derived from fta.recreation_struct_dimen_xref. |
| 4 | + |
| 5 | +alter table rst.recreation_asset_code |
| 6 | + add column if not exists has_length boolean not null default false, |
| 7 | + add column if not exists has_width boolean not null default false, |
| 8 | + add column if not exists has_area boolean not null default false; |
| 9 | + |
| 10 | +comment on column rst.recreation_asset_code.has_length is 'Indicates whether a length measurement is applicable for this asset type (dimension code L).'; |
| 11 | +comment on column rst.recreation_asset_code.has_width is 'Indicates whether a width measurement is applicable for this asset type (dimension code W).'; |
| 12 | +comment on column rst.recreation_asset_code.has_area is 'Indicates whether an area measurement is applicable for this asset type (dimension code A).'; |
| 13 | + |
| 14 | +-- Set has_length = true for asset codes that have dimension code 'L' |
| 15 | +update rst.recreation_asset_code |
| 16 | +set has_length = true |
| 17 | +where asset_code in ( |
| 18 | + 21, -- Parking - Unimproved |
| 19 | + 22, -- Parking - Unsurfaced |
| 20 | + 23, -- Parking - Spaces Gravel |
| 21 | + 24, -- Parking - Spaces Pavement |
| 22 | + 25, -- Parking - Wheelchair Accessible |
| 23 | + 30, -- Boat Launch - Cartop (Unimproved) |
| 24 | + 32, -- Boat Launch - Gravel |
| 25 | + 33, -- Boat Launch - Concrete |
| 26 | + 36, -- Safety Barrier |
| 27 | + 46, -- Shelter (Cabins, Warming Huts) |
| 28 | + 47, -- Shelter - Wheelchair Accessible |
| 29 | + 54, -- Dock Wharf |
| 30 | + 60, -- Boardwalk |
| 31 | + 62, -- Bridge - Foot (<6M) |
| 32 | + 63, -- Bridge - Wheelchair Accessible |
| 33 | + 71, -- Hitching Rail |
| 34 | + 78, -- Trail |
| 35 | + 79, -- Trail - Wheelchair Accessible |
| 36 | + 81, -- Tent Pad |
| 37 | + 86, -- Total Length of Associated Roads |
| 38 | + 87, -- Dock Pier |
| 39 | + 88, -- Dock Floating |
| 40 | + 96, -- Gate |
| 41 | + 97, -- In-Site Road |
| 42 | + 98, -- Culvert |
| 43 | + 103, -- Bridge - Vehicle |
| 44 | + 104, -- Bridge - Foot (Suspension) |
| 45 | + 105, -- Cable Car |
| 46 | + 109, -- Fencing - Barb Wire |
| 47 | + 110, -- Fencing - Log |
| 48 | + 111, -- Fencing - Chain Link |
| 49 | + 200, -- Barrier - No Post |
| 50 | + 201, -- Barrier - Lock Block |
| 51 | + 210, -- Barrier - Rock |
| 52 | + 216, -- Fencing - Strand |
| 53 | + 225, -- Barrier - Wood |
| 54 | + 226 -- Bridge - Foot |
| 55 | +); |
| 56 | + |
| 57 | +-- Set has_width = true for asset codes that have dimension code 'W' |
| 58 | +update rst.recreation_asset_code |
| 59 | +set has_width = true |
| 60 | +where asset_code in ( |
| 61 | + 21, -- Parking - Unimproved |
| 62 | + 22, -- Parking - Unsurfaced |
| 63 | + 23, -- Parking - Spaces Gravel |
| 64 | + 24, -- Parking - Spaces Pavement |
| 65 | + 25, -- Parking - Wheelchair Accessible |
| 66 | + 46, -- Shelter (Cabins, Warming Huts) |
| 67 | + 47, -- Shelter - Wheelchair Accessible |
| 68 | + 54, -- Dock Wharf |
| 69 | + 60, -- Boardwalk |
| 70 | + 81, -- Tent Pad |
| 71 | + 87, -- Dock Pier |
| 72 | + 88, -- Dock Floating |
| 73 | + 97, -- In-Site Road |
| 74 | + 98 -- Culvert |
| 75 | +); |
| 76 | + |
| 77 | +-- Set has_area = true for asset codes that have dimension code 'A' |
| 78 | +update rst.recreation_asset_code |
| 79 | +set has_area = true |
| 80 | +where asset_code in ( |
| 81 | + 21, -- Parking - Unimproved |
| 82 | + 22, -- Parking - Unsurfaced |
| 83 | + 23, -- Parking - Spaces Gravel |
| 84 | + 24, -- Parking - Spaces Pavement |
| 85 | + 25 -- Parking - Wheelchair Accessible |
| 86 | +); |
| 87 | + |
| 88 | +select sync_temporal_table_schema('rst', 'recreation_asset_code'); |
0 commit comments