Skip to content

Commit 032e1f1

Browse files
committed
chore: updated recreation asset code
1 parent 9c6e29a commit 032e1f1

3 files changed

Lines changed: 100 additions & 0 deletions

File tree

admin/backend/prisma/schema.prisma

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,9 @@ model recreation_asset_code {
15501550
created_at DateTime? @default(now()) @db.Timestamp(6)
15511551
created_by String?
15521552
sys_period Unsupported("tstzrange") @default(dbgenerated("tstzrange(CURRENT_TIMESTAMP, NULL::timestamp with time zone)"))
1553+
has_length Boolean @default(false)
1554+
has_width Boolean @default(false)
1555+
has_area Boolean @default(false)
15531556
recreation_asset recreation_asset[]
15541557
15551558
@@schema("rst")
@@ -1564,6 +1567,9 @@ model recreation_asset_code_history {
15641567
created_at DateTime? @db.Timestamp(6)
15651568
created_by String?
15661569
sys_period Unsupported("tstzrange")
1570+
has_length Boolean @default(false)
1571+
has_width Boolean @default(false)
1572+
has_area Boolean @default(false)
15671573
15681574
@@ignore
15691575
@@schema("rst")
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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');

public/backend/prisma/schema.prisma

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,9 @@ model recreation_asset_code {
14471447
created_at DateTime? @default(now()) @db.Timestamp(6)
14481448
created_by String?
14491449
sys_period Unsupported("tstzrange") @default(dbgenerated("tstzrange(CURRENT_TIMESTAMP, NULL::timestamp with time zone)"))
1450+
has_length Boolean @default(false)
1451+
has_width Boolean @default(false)
1452+
has_area Boolean @default(false)
14501453
recreation_asset recreation_asset[]
14511454
14521455
@@schema("rst")
@@ -1461,6 +1464,9 @@ model recreation_asset_code_history {
14611464
created_at DateTime? @db.Timestamp(6)
14621465
created_by String?
14631466
sys_period Unsupported("tstzrange")
1467+
has_length Boolean @default(false)
1468+
has_width Boolean @default(false)
1469+
has_area Boolean @default(false)
14641470
14651471
@@ignore
14661472
@@schema("rst")

0 commit comments

Comments
 (0)