From 7a5ef12297cd0a822ce6d6e54da1bf9da1a9f990 Mon Sep 17 00:00:00 2001 From: marcellmueller Date: Mon, 23 Dec 2024 12:43:18 -0800 Subject: [PATCH] chore: add all fta rst tables and columns --- migrations/sql/V1.0.0__init.sql | 2 +- migrations/sql/V1.0.1__alter_user_seq.sql | 1 - migrations/sql/V1.0.1__rst_db.sql | 506 ++++++++++++++++++++++ 3 files changed, 507 insertions(+), 2 deletions(-) delete mode 100644 migrations/sql/V1.0.1__alter_user_seq.sql create mode 100644 migrations/sql/V1.0.1__rst_db.sql diff --git a/migrations/sql/V1.0.0__init.sql b/migrations/sql/V1.0.0__init.sql index 3b3a1ca..72b05d6 100644 --- a/migrations/sql/V1.0.0__init.sql +++ b/migrations/sql/V1.0.0__init.sql @@ -12,7 +12,7 @@ INSERT INTO RST.RECREATION_RESOURCE (FOREST_FILE_ID, NAME, DESCRIPTION, SITE_LOC VALUES ('REC5600', 'A Walk In The Forest Trail (Lost Shoe)', 'Trail offers two short loops under a mainly cedar canopy. Some boardwalks and bridges have been constructed to cross over a babbling creek. This is a rainforest and one should use caution while navigating the trail''s slippery sections.', 'Tofino'), ('REC1585', 'Aberdeen Lake', 'This semi-open site on a medium sized fishing lake is subject to significant water level fluctuations. The access is very rough for 2 km before the site.', 'Lavington'), ('REC5763', 'Ahdatay', 'Located on the north shore of Tchentlo Lake, 1. 5 km from the mouth of the Nation River between Tchentlo and Chuchi Lake.', 'Fort St. James'), - ('REC2602', 'Alexis Lake', 'Located north of Alexis Creek, Alexis Lake is a popular fishing destination and day use area. This family friendly site has five units, a cartop boat launch and a small sandy beach for swimming. Boaters should take notice that power-driven vessels are prohibited on this lake under the Vessel Operation Restriction Regulations (Transport Canada). Electric motors are permitted.', 'Alexis Creek'), + ('REC2602', 'Alexis Lake', 'Located north of Alexis Creek, Alexis Lake is a popular fishing destination and day use area. This family friendly site has five units, a cartop boat launch and a small sandy beach for swimming. Boaters should take notice that power-driven vessels are prohibited on this lake under the Vessel Operation Restriction Regulations (Transport Canada). Electric motors are permitted.', 'Alexis Creek'), ('REC0019', 'Allison Pool', 'A small site along the banks of the Chilliwack River; accessed off the Chilliwack Lake Road. This site is not suitable for large RVs due to the gravel road access. The site is popular with anglers and has access to the Trans Canada Trail. The site is designed as a group site and can be reserved during camping season. This is a CASH ONLY site. For reservations, additional information and updates, please visit www.chilliwackvalleycampsites.ca. or email thurstonmeadows@yahoo.ca or call: 604-824-0576.', 'Chilliwack'), ('REC6622', 'Amor West', 'Located along the Sayward Forest Canoe Route, this is a popular stop for paddlers making their way along the route. In summer when water levels are lower, there is plenty of room to camp on the beach.', 'Campbell River'), ('REC1496', 'Angly Lake', 'A small, narrow lake in the hills above Ormond Lake. One vehicle unit.', 'Fort St. James'); diff --git a/migrations/sql/V1.0.1__alter_user_seq.sql b/migrations/sql/V1.0.1__alter_user_seq.sql deleted file mode 100644 index 62f68c7..0000000 --- a/migrations/sql/V1.0.1__alter_user_seq.sql +++ /dev/null @@ -1 +0,0 @@ --- ALTER SEQUENCE USERS."USER_SEQ" RESTART WITH 6 CACHE 1; diff --git a/migrations/sql/V1.0.1__rst_db.sql b/migrations/sql/V1.0.1__rst_db.sql new file mode 100644 index 0000000..919eb49 --- /dev/null +++ b/migrations/sql/V1.0.1__rst_db.sql @@ -0,0 +1,506 @@ +CREATE EXTENSION postgis; +CREATE EXTENSION "uuid-ossp"; + +CREATE TABLE RECREATION_PROJECT ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + PROJECT_NAME VARCHAR(100), + RECREATION_CONTROL_ACCESS_CODE VARCHAR(1) NULL, + RECREATION_FEATURE_CODE VARCHAR(3) NULL, + RECREATION_MAINTAIN_STD_CODE VARCHAR(1) NULL, + RECREATION_RISK_RATING_CODE VARCHAR(3) NULL, + UTM_ZONE INT NULL, + LAST_REC_INSPECTION_DATE DATE NULL, + REC_PROJECT_SKEY INT NULL, + RESOURCE_FEATURE_IND VARCHAR(1) DEFAULT 'N', + LAST_HZRD_TREE_ASSESS_DATE DATE NULL, + SITE_DESCRIPTION VARCHAR(500) NULL, + RECREATION_USER_DAYS_CODE VARCHAR(3) NULL, + OVERFLOW_CAMPSITES INT NULL, + UTM_NORTHING INT NULL, + UTM_EASTING INT NULL, + RIGHT_OF_WAY NUMERIC(7, 1) NULL, + ARCH_IMPACT_ASSESS_IND VARCHAR(1) NULL, + SITE_LOCATION VARCHAR(500) NULL, + PROJECT_ESTABLISHED_DATE DATE NULL, + RECREATION_VIEW_IND VARCHAR(1) DEFAULT 'N', + REVISION_COUNT INT NULL, + ENTRY_USERID VARCHAR(30) NULL, + ENTRY_TIMESTAMP DATE NULL, + UPDATE_USERID VARCHAR(30) NULL, + UPDATE_TIMESTAMP DATE NULL, + ARCH_IMPACT_DATE DATE NULL, + BORDEN_NO VARCHAR(200) NULL, + CAMP_HOST_IND VARCHAR(1) DEFAULT 'N', + LOW_MOBILITY_ACCESS_IND VARCHAR(1) DEFAULT 'N' +); + +CREATE TABLE RECREATION_ACCESS ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + RECREATION_ACCESS_CODE VARCHAR(3) NOT NULL, + RECREATION_SUB_ACCESS_CODE VARCHAR(3) NOT NULL, + REVISION_COUNT INTEGER, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_ACCESS_CODE ( + RECREATION_ACCESS_CODE VARCHAR(3) NOT NULL, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_ACCESS_XREF ( + RECREATION_ACCESS_CODE VARCHAR(3) NOT NULL, + RECREATION_SUB_ACCESS_CODE VARCHAR(3) NOT NULL, + REVISION_COUNT INTEGER, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP, + FOREST_FILE_ID VARCHAR(10) +); + +CREATE TABLE RECREATION_ACTIVITY ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + RECREATION_ACTIVITY_CODE VARCHAR(3) NOT NULL, + ACTIVITY_RANK INT, + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_ACTIVITY_CODE ( + RECREATION_ACTIVITY_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_AGREEMENT_HOLDER ( + AGREEMENT_HOLDER_ID SERIAL PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10) REFERENCES RECREATION_PROJECT(FOREST_FILE_ID) ON DELETE RESTRICT, + CLIENT_NUMBER VARCHAR(8), + CLIENT_LOCN_CODE VARCHAR(2), + AGREEMENT_START_DATE DATE, + AGREEMENT_END_DATE DATE, + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_ATTACHMENT ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + RECREATION_ATTACHMENT_ID SERIAL NOT NULL, + ATTACHMENT_FILE_NAME VARCHAR(50), + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_ATTACHMENT_CONTENT ( + FOREST_FILE_ID VARCHAR(10) REFERENCES RECREATION_ATTACHMENT(FOREST_FILE_ID) ON DELETE RESTRICT, + RECREATION_ATTACHMENT_ID INT, + ATTACHMENT_CONTENT BYTEA, + PRIMARY KEY (FOREST_FILE_ID, RECREATION_ATTACHMENT_ID) +); + +CREATE TABLE RECREATION_COMMENT ( + FOREST_FILE_ID VARCHAR(10) REFERENCES RECREATION_PROJECT(FOREST_FILE_ID) ON DELETE RESTRICT, + RECREATION_COMMENT_ID SERIAL PRIMARY KEY, + REC_COMMENT_TYPE_CODE VARCHAR(4), + CLOSURE_IND CHAR(1) DEFAULT 'N', + PROJECT_COMMENT VARCHAR(2000), + COMMENT_DATE DATE, + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_CONTROL_ACCESS_CODE ( + RECREATION_CONTROL_ACCESS_CODE VARCHAR(1) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_DEF_CS_RPR_HISTORY ( + FOREST_FILE_ID VARCHAR(10) NOT NULL, + CAMPSITE_NUMBER INT NOT NULL, + RECREATION_REMED_REPAIR_CODE VARCHAR(2) NULL, + ESTIMATED_REPAIR_COST NUMERIC(7, 2) NULL, + REPAIR_COMPLETE_DATE DATE NULL, + REVISION_COUNT INT NULL, + ENTRY_USERID VARCHAR(30) NULL, + ENTRY_TIMESTAMP TIMESTAMP NULL, + UPDATE_USERID VARCHAR(30) NULL, + UPDATE_TIMESTAMP TIMESTAMP NULL, + PRIMARY KEY (FOREST_FILE_ID, CAMPSITE_NUMBER) +); + +CREATE TABLE RECREATION_DEFINED_CAMPSITE ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + CAMPSITE_NUMBER INT NOT NULL, + ESTIMATED_REPAIR_COST NUMERIC(7,2), + RECREATION_REMED_REPAIR_CODE VARCHAR(2), + REPAIR_COMPLETE_DATE DATE, + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_DISTRICT_CODE ( + RECREATION_DISTRICT_CODE VARCHAR(4) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_DISTRICT_XREF ( + FOREST_FILE_ID VARCHAR(10) NOT NULL, + RECREATION_DISTRICT_CODE VARCHAR(4) NOT NULL, + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_FEATURE_CODE ( + RECREATION_FEATURE_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_FEE_CODE ( + RECREATION_FEE_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_FEE ( + FEE_ID SERIAL PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10) REFERENCES RECREATION_PROJECT(FOREST_FILE_ID) ON DELETE RESTRICT, + FEE_AMOUNT NUMERIC(5,2) DEFAULT NULL, + FEE_START_DATE DATE DEFAULT NULL, + FEE_END_DATE DATE DEFAULT NULL, + MONDAY_IND VARCHAR(1) DEFAULT 'N', + TUESDAY_IND VARCHAR(1) DEFAULT 'N', + WEDNESDAY_IND VARCHAR(1) DEFAULT 'N', + THURSDAY_IND VARCHAR(1) DEFAULT 'N', + FRIDAY_IND VARCHAR(1) DEFAULT 'N', + SATURDAY_IND VARCHAR(1) DEFAULT 'N', + SUNDAY_IND VARCHAR(1) DEFAULT 'N', + RECREATION_FEE_CODE VARCHAR(3) REFERENCES RECREATION_FEE_CODE(RECREATION_FEE_CODE) ON DELETE RESTRICT, + REVISION_COUNT NUMERIC(5) DEFAULT NULL, + ENTRY_USERID VARCHAR(30) DEFAULT NULL, + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30) DEFAULT NULL, + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_FILE_STATUS_CODE ( + RECREATION_FILE_STATUS_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_FILE_TYPE_CODE ( + RECREATION_FILE_TYPE_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP DATE +); + +CREATE TABLE RECREATION_INSPECTION_REPORT ( + INSPECTION_ID NUMERIC PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10), + SITE_OCCUPANCY_CODE VARCHAR(10), + REC_FILE_TYPE_CODE VARCHAR(10), + SITE_NAME VARCHAR(50), + LOCATION VARCHAR(100), + INSPECTED_BY VARCHAR(30), + CAMPSITE_NO NUMERIC, + OCCUPIED_CAMPSITE_NO NUMERIC, + VEHICLE_NO NUMERIC, + CAMPING_PARTY_NO NUMERIC, + DAY_USE_PARTY_NO NUMERIC, + WITH_PASS_NO NUMERIC, + WITHOUT_PASS_NO NUMERIC, + ABSENT_OWNER_NO NUMERIC, + TOTAL_INSPECTED_NO NUMERIC, + PURCHASED_PASS_NO NUMERIC, + REFUSED_PASS_NO NUMERIC, + CONTRACT_ID VARCHAR(20), + CONTRACTOR VARCHAR(30), + REC_PROJECT_SKEY NUMERIC, + ENTRY_USERID VARCHAR(30) DEFAULT NULL, + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30) DEFAULT NULL, + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_MAINTAIN_STD_CODE ( + RECREATION_MAINTAIN_STD_CODE VARCHAR(1) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_MAP_FEATURE_CODE ( + RECREATION_MAP_FEATURE_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_MAP_FEATURE_GEOM ( + RMF_SKEY SERIAL PRIMARY KEY, + MAP_FEATURE_ID INT, + GEOMETRY_TYPE_CODE VARCHAR(4), + GEOMETRY GEOMETRY, + FEATURE_AREA NUMERIC(11,4), + FEATURE_LENGTH NUMERIC(11,4), + FEATURE_PERIMETER NUMERIC(11,4), + REVISION_COUNT INT, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_MAP_FEATURE_XGUID ( + RMF_GUID BYTEA PRIMARY KEY, + RMF_SKEY INT +); + +CREATE TABLE RECREATION_MAP_FEATURE ( + RMF_SKEY INTEGER PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10), + SECTION_ID VARCHAR(30) NULL, + AMENDMENT_ID INTEGER, + AMEND_STATUS_CODE VARCHAR(3), + RECREATION_MAP_FEATURE_CODE VARCHAR(3), + CURRENT_IND VARCHAR(1), + AMEND_STATUS_DATE DATE, + RETIREMENT_DATE DATE NULL, + REVISION_COUNT INTEGER, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP DATE, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP DATE, + RECREATION_MAP_FEATURE_GUID UUID DEFAULT uuid_generate_v4() +); + +CREATE TABLE RECREATION_OBJECTIVE ( + OBJECTIVE_ID SERIAL PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10) NOT NULL, + OBJECTIVE_DESCRIPTION VARCHAR(2000), + OBJECTIVE_ESTABLISHED_DATE DATE, + OBJECTIVE_AMENDED_DATE DATE, + OBJECTIVE_CANCELLED_DATE DATE, + REVISION_COUNT INTEGER DEFAULT 0, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_OCCUPANCY_CODE ( + RECREATION_OCCUPANCY_CODE VARCHAR(10) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_PLAN ( + FOREST_FILE_ID VARCHAR(10), + REC_PROJECT_SKEY INT, + PLAN_TYPE_CODE CHAR(1), + REMARKS VARCHAR(254), + PRIMARY KEY (FOREST_FILE_ID, REC_PROJECT_SKEY, PLAN_TYPE_CODE) +); + +CREATE TABLE RECREATION_REMED_REPAIR_CODE ( + RECREATION_REMED_REPAIR_CODE VARCHAR(2) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_RISK_EVALUATION ( + RISK_EVALUATION_ID BIGINT PRIMARY KEY, + RECREATION_USER_DAYS_CODE VARCHAR(10), + RECREATION_OCCUPANCY_CODE VARCHAR(10), + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + ENTRY_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30) +); + +CREATE TABLE RECREATION_RISK_RATING_CODE ( + RECREATION_RISK_RATING_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_RISK_SITE ( + RISK_SITE_ID SERIAL PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10), + ENTRY_TIMESTAMP DATE, + ENTRY_USERID VARCHAR(30), + UPDATE_TIMESTAMP DATE, + UPDATE_USERID VARCHAR(30) +); + +CREATE TABLE RECREATION_SEARCH_RESULT ( + FOREST_FILE_ID VARCHAR(10) NULL, + ORG_UNIT_CODE VARCHAR(6) NULL, + ORG_UNIT_NAME VARCHAR(100) NULL, + FILE_STATUS_CODE VARCHAR(3) NULL, + PROJECT_NAME VARCHAR(100) NULL, + PROJECT_TYPE VARCHAR(240) NULL, + RECREATION_PROJECT_CODE VARCHAR(3) NULL, + RECREATION_PROJECT_CODE_DESC VARCHAR(120) NULL +); + +CREATE TABLE RECREATION_SITE ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + REC_SITE_NAME VARCHAR(50) NULL +); + +CREATE TABLE RECREATION_SITE_POINT ( + FOREST_FILE_ID VARCHAR(10) PRIMARY KEY, + GEOMETRY GEOMETRY, + REVISION_COUNT INTEGER, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_STRUCT_DIMEN_CODE ( + RECREATION_STRUCT_DIMEN_CODE VARCHAR(2) PRIMARY KEY, + DESCRIPTION VARCHAR(120) NULL, + EFFECTIVE_DATE DATE NULL, + EXPIRY_DATE DATE NULL, + UPDATE_TIMESTAMP DATE NULL +); + +CREATE TABLE RECREATION_STRUCT_DIMEN_XREF ( + RECREATION_STRUCTURE_CODE VARCHAR(3), + RECREATION_STRUCT_DIMEN_CODE VARCHAR(2), + REVISION_COUNT INT NULL, + ENTRY_USERID VARCHAR(30) NULL, + ENTRY_TIMESTAMP TIMESTAMP NULL, + UPDATE_USERID VARCHAR(30) NULL, + UPDATE_TIMESTAMP TIMESTAMP NULL, + PRIMARY KEY (RECREATION_STRUCTURE_CODE, RECREATION_STRUCT_DIMEN_CODE) +); + +CREATE TABLE RECREATION_STRUCTURE_CODE ( + RECREATION_STRUCTURE_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP DATE +); + +CREATE TABLE RECREATION_STRUCTURE ( + STRUCTURE_ID NUMERIC(10) PRIMARY KEY, + FOREST_FILE_ID VARCHAR(10) NOT NULL REFERENCES RECREATION_PROJECT (FOREST_FILE_ID) ON DELETE RESTRICT, + CAMPSITE_FOREST_FILE_ID VARCHAR(10) NULL, + CAMPSITE_NUMBER NUMERIC(3) NULL, + RECREATION_STRUCTURE_CODE VARCHAR(3) NULL REFERENCES RECREATION_STRUCTURE_CODE (RECREATION_STRUCTURE_CODE) ON DELETE RESTRICT, + STRUCTURE_NAME VARCHAR(100), + STRUCTURE_COUNT NUMERIC(3), + STRUCTURE_LENGTH NUMERIC(7, 1), + STRUCTURE_WIDTH NUMERIC(7, 1), + STRUCTURE_AREA NUMERIC(7, 1), + ACTUAL_VALUE NUMERIC(7, 2), + RECREATION_REMED_REPAIR_CODE VARCHAR(2) NULL REFERENCES RECREATION_REMED_REPAIR_CODE (RECREATION_REMED_REPAIR_CODE) ON DELETE RESTRICT, + ESTIMATED_REPAIR_COST NUMERIC(10, 2), + REPAIR_COMPLETED_DATE DATE, + REVISION_COUNT NUMERIC(5), + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE RECREATION_STRUCTURE_VALUE ( + RECREATION_STRUCTURE_CODE VARCHAR(3) NOT NULL, + STRUCTURE_VALUE NUMERIC(7, 2), + DIMENSION VARCHAR(1) DEFAULT 'U', + REVISION_COUNT NUMERIC(5), + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP DATE, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP DATE, + PRIMARY KEY (RECREATION_STRUCTURE_CODE) +); + +CREATE TABLE RECREATION_SUB_ACCESS_CODE ( + RECREATION_SUB_ACCESS_CODE VARCHAR(3) PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +); + +CREATE TABLE RECREATION_TRAIL_SEGMENT ( + FOREST_FILE_ID VARCHAR(10) NOT NULL, + RECREATION_TRAIL_SEG_ID SERIAL NOT NULL, + TRAIL_SEGMENT_NAME VARCHAR(50), + START_STATION NUMERIC(11, 4), + END_STATION NUMERIC(11, 4), + RECREATION_REMED_REPAIR_CODE VARCHAR(2), + ESTIMATED_REPAIR_COST NUMERIC(10, 2), + ACTUAL_REPAIR_COST NUMERIC(10, 2), + REPAIR_COMPLETED_DATE DATE, + WHEELCHAIR_ACCESSIBLE_IND CHAR(1), + REVISION_COUNT INTEGER, + ENTRY_USERID VARCHAR(30), + ENTRY_TIMESTAMP TIMESTAMP, + UPDATE_USERID VARCHAR(30), + UPDATE_TIMESTAMP TIMESTAMP, + PRIMARY KEY (FOREST_FILE_ID, RECREATION_TRAIL_SEG_ID), + UNIQUE (FOREST_FILE_ID, TRAIL_SEGMENT_NAME) +); + +CREATE TABLE RECREATION_USER_DAYS_CODE ( + RECREATION_USER_DAYS_CODE VARCHAR(10) NOT NULL PRIMARY KEY, + DESCRIPTION VARCHAR(120), + EFFECTIVE_DATE DATE, + EXPIRY_DATE DATE, + UPDATE_TIMESTAMP TIMESTAMP +);