/* ---------------------------------------------------- */
/*  Generated by Enterprise Architect Version 15.2 		*/
/*  Created On : 04-May-2022 21:43:56 				*/
/*  DBMS       : PostgreSQL 						*/
/* ---------------------------------------------------- */

/* Drop Tables */

DROP TABLE IF EXISTS "Eventreport" CASCADE
;

/* Create Tables */

CREATE TABLE "Eventreport"
(
	"Typeofevent" varchar NULL,	-- The type of event, taken from the EventType codelist (e.g. tree removal, storm damage etc).
	"Validperiod" varchar NULL,
	"EventreportID" varchar NOT NULL
)
;

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

ALTER TABLE "Eventreport" ADD CONSTRAINT "PK_Eventreport"
	PRIMARY KEY ("EventreportID")
;

/* Create Foreign Key Constraints */

ALTER TABLE "Eventreport" ADD CONSTRAINT "FK_EventReport_LogEntry"
	FOREIGN KEY ("EventreportID") REFERENCES "Logentry" ("LogentryID") ON DELETE No Action ON UPDATE No Action
;

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

COMMENT ON COLUMN "Eventreport"."Typeofevent"
	IS 'The type of event, taken from the EventType codelist (e.g. tree removal, storm damage etc).'
;