-- Table: events_events

-- DROP TABLE events_events;

CREATE TABLE events_events
(
  id bigserial NOT NULL,
  carparkid bigint,
  cleared boolean NOT NULL,
  datetime timestamp with time zone,
  identity character varying(255),
  generatedbystationid bigint,
  eventtype_id bigint NOT NULL,
  relatedstationid bigint,
  processingstatus character varying(255) NOT NULL,
  CONSTRAINT events_events_pkey PRIMARY KEY (id),
  CONSTRAINT fk88fe3effa0559276 FOREIGN KEY (eventtype_id)
      REFERENCES events_event_types (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
  OIDS=FALSE
);
ALTER TABLE events_events OWNER TO postgres;

-- Index: events_events_cleared_ind

-- DROP INDEX events_events_cleared_ind;

CREATE INDEX events_events_cleared_ind
  ON events_events
  USING btree
  (cleared);

-- Index: events_events_datetime_ind

-- DROP INDEX events_events_datetime_ind;

CREATE INDEX events_events_datetime_ind
  ON events_events
  USING btree
  (datetime);

-- Index: events_events_identity_ind

-- DROP INDEX events_events_identity_ind;

CREATE INDEX events_events_identity_ind
  ON events_events
  USING btree
  (identity);



-- Table: events_event_types

-- DROP TABLE events_event_types;

CREATE TABLE events_event_types
(
  id bigserial NOT NULL,
  alarm boolean NOT NULL,
  "name" character varying(255) NOT NULL,
  severity bigint,
  CONSTRAINT events_event_types_pkey PRIMARY KEY (id),
  CONSTRAINT events_event_types_name_key UNIQUE (name)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE events_event_types OWNER TO postgres;

-- Index: events_event_types_severity_ind

-- DROP INDEX events_event_types_severity_ind;

CREATE INDEX events_event_types_severity_ind
  ON events_event_types
  USING btree
  (severity);

