Skip to content

Commit

Permalink
Feature/wfprev 193 (#382) (#383)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Saldyga <[email protected]>
  • Loading branch information
ssylver93 and hsaldyga authored Dec 30, 2024
1 parent 3a1ff96 commit def70d2
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
31 changes: 31 additions & 0 deletions db/app_wf1_prev-changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,37 @@
{ "sql": "DROP SEQUENCE wfprev.project_number_seq" }
]
}
},
{
"changeSet": {
"id": "01_00_03_00",
"author": "hsaldyga",
"tagDatabase": { "tag" : "version_01_00_03_00" },
"changes": [
{
"sqlFile": {
"dbms": "postgresql",
"endDelimiter": ";",
"path": "scripts/01_00_03/00/ddl/WFPREV.create_objective_type_code.sql"
}
},
{
"sqlFile": {
"dbms": "postgresql",
"endDelimiter": ";",
"path": "scripts/01_00_03/00/ddl/WFPREV.alter_project.sql"
}
}
],
"rollback": [
{ "sql": "ALTER TABLE wfprev.project DROP COLUMN primary_objective_type_code" },
{ "sql": "ALTER TABLE wfprev.project DROP COLUMN secondary_objective_type_code" },
{ "sql": "ALTER TABLE wfprev.project DROP COLUMN secondary_objective_rationale" },
{ "sql": "ALTER TABLE wfprev.project DROP COLUMN tertiary_objective_type_code" },
{ "sql": "ALTER TABLE wfprev.project DROP COLUMN tertiary_objective_rationale" },
{ "sql": "DROP TABLE wfprev.objective_type_code" }
]
}
}
]
}
32 changes: 32 additions & 0 deletions db/scripts/01_00_03/00/ddl/WFPREV.alter_project.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ALTER TABLE "wfprev"."project" ADD COLUMN "primary_objective_type_code" varchar(10);
COMMENT ON COLUMN "wfprev"."project"."primary_objective_type_code"
IS 'primary_objective_type_code: Is a foreign key to objective_type_code: Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other';
CREATE INDEX "prjct_objtcd_primary_idx" ON "wfprev"."project" ("primary_objective_type_code" ASC);
ALTER TABLE "wfprev"."project" ADD CONSTRAINT "prjct_objtcd_primary_fk"
FOREIGN KEY ("primary_objective_type_code") REFERENCES "wfprev"."objective_type_code" ("objective_type_code") ON DELETE No Action ON UPDATE No Action;

ALTER TABLE "wfprev"."project" ADD COLUMN "secondary_objective_type_code" varchar(10);
COMMENT ON COLUMN "wfprev"."project"."secondary_objective_type_code"
IS 'secondary_objective_type_code: Is a foreign key to objective_type_code: Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other';
CREATE INDEX "prjct_objtcd_secondary_idx" ON "wfprev"."project" ("secondary_objective_type_code" ASC);
ALTER TABLE "wfprev"."project" ADD CONSTRAINT "prjct_objtcd_secondary_fk"
FOREIGN KEY ("secondary_objective_type_code") REFERENCES "wfprev"."objective_type_code" ("objective_type_code") ON DELETE No Action ON UPDATE No Action;

ALTER TABLE "wfprev"."project" ADD COLUMN "secondary_objective_rationale" varchar(200);
COMMENT ON COLUMN "wfprev"."project"."secondary_objective_rationale"
IS 'Secondary Objective Rationale may be supplied when a Secondary Objective Type code is specified.';

ALTER TABLE "wfprev"."project" ADD COLUMN "tertiary_objective_type_code" varchar(10);
COMMENT ON COLUMN "wfprev"."project"."tertiary_objective_type_code"
IS 'tertiary_objective_type_code: Is a foreign key to objective_type_code: Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other';
CREATE INDEX "prjct_objtcd_tertiary_idx" ON "wfprev"."project" ("tertiary_objective_type_code" ASC);
ALTER TABLE "wfprev"."project" ADD CONSTRAINT "prjct_objtcd_tertiary_fk"
FOREIGN KEY ("tertiary_objective_type_code") REFERENCES "wfprev"."objective_type_code" ("objective_type_code") ON DELETE No Action ON UPDATE No Action;

ALTER TABLE "wfprev"."project" ADD COLUMN "tertiary_objective_rationale" varchar(200);
COMMENT ON COLUMN "wfprev"."project"."tertiary_objective_rationale"
IS 'Tertiary Objective Rationale may be supplied when a Tertiary Objective Type code is specified.';




75 changes: 75 additions & 0 deletions db/scripts/01_00_03/00/ddl/WFPREV.create_objective_type_code.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
/* Created On : 10-Dec-2024 4:38:45 PM */
/* DBMS : PostgreSQL */
/* ---------------------------------------------------- */

/* Create Tables */

CREATE TABLE "wfprev"."objective_type_code"
(
"objective_type_code" varchar(10) NOT NULL, -- objective_type_code: Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other
"description" varchar(200) NOT NULL, -- DESCRIPTION is the display quality description of the code value.
"display_order" decimal(3) NULL, -- DISPLAY ORDER is to allow non alphabetic sorting e.g. M T W Th F S S.
"effective_date" DATE NOT NULL DEFAULT CURRENT_DATE, -- EFFECTIVE_DATE is the date code value becomes effective.
"expiry_date" DATE NOT NULL DEFAULT '9999-12-31', -- EXPIRY_DATE is the date code value expires.
"revision_count" decimal(10) NOT NULL DEFAULT 0, -- REVISION_COUNT is the number of times that the row of data has been changed. The column is used for optimistic locking via application code.
"create_user" varchar(64) NOT NULL, -- CREATE_USER is an audit column that indicates the user that created the record.
"create_date" DATE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- CREATE_DATE is the date and time the row of data was created.
"update_user" varchar(64) NOT NULL, -- UPDATE_USER is an audit column that indicates the user that updated the record.
"update_date" DATE NOT NULL DEFAULT CURRENT_TIMESTAMP -- UPDATE_DATE is the date and time the row of data was updated.
)
TABLESPACE PG_DEFAULT
;

/* Create Table Comments, Sequences for Autonumber Columns */

COMMENT ON TABLE "wfprev"."objective_type_code"
IS 'Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."objective_type_code"
IS 'objective_type_code: Objective Type Code is the set of objectives that are desired outcomes for a project. Values are: - Wildfire Risk Reduction - Critical Infrastructure - Ecosystem Restoration - Egress/Evacuation - Forest Health - Hazard Abatement - Range Habitat Management - Reconciliation - Wildfire Habitat Management - Other'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."description"
IS 'DESCRIPTION is the display quality description of the code value.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."display_order"
IS 'DISPLAY ORDER is to allow non alphabetic sorting e.g. M T W Th F S S.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."effective_date"
IS 'EFFECTIVE_DATE is the date code value becomes effective.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."expiry_date"
IS 'EXPIRY_DATE is the date code value expires.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."revision_count"
IS 'REVISION_COUNT is the number of times that the row of data has been changed. The column is used for optimistic locking via application code.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."create_user"
IS 'CREATE_USER is an audit column that indicates the user that created the record.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."create_date"
IS 'CREATE_DATE is the date and time the row of data was created.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."update_user"
IS 'UPDATE_USER is an audit column that indicates the user that updated the record.'
;

COMMENT ON COLUMN "wfprev"."objective_type_code"."update_date"
IS 'UPDATE_DATE is the date and time the row of data was updated.'
;

/* Create Primary Keys, Indexes, Uniques, Checks */

ALTER TABLE "wfprev"."objective_type_code" ADD CONSTRAINT "objtcd_pk"
PRIMARY KEY ("objective_type_code")
;

0 comments on commit def70d2

Please sign in to comment.