SCSArchiverCSStudioPostgreSqlGsiTablesSchemeCSSEE

Introduction

-- Table: archive_schema

-- DROP TABLE archive_schema;

CREATE TABLE archive_schema
(

)
WITH (
  OIDS=FALSE
);
ALTER TABLE archive_schema
  OWNER TO "p.zumbruch";

  -- Table: array_val

-- DROP TABLE array_val;

CREATE TABLE array_val
(
  channel_id bigint NOT NULL,
  smpl_time timestamp without time zone NOT NULL,
  nanosecs bigint NOT NULL,
  seq_nbr bigint NOT NULL,
  float_val double precision,
  CONSTRAINT array_val_channel_id_fkey FOREIGN KEY (channel_id)
      REFERENCES channel (channel_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE CASCADE
)
WITH (
  OIDS=FALSE
);
ALTER TABLE array_val
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE array_val TO "p.zumbruch";
GRANT SELECT ON TABLE array_val TO epics;

-- Index: array_val_id_time

-- DROP INDEX array_val_id_time;

CREATE INDEX array_val_id_time
  ON array_val
  USING btree
  (channel_id, smpl_time, nanosecs);

-- Table: chan_grp

-- DROP TABLE chan_grp;

CREATE TABLE chan_grp
(
  grp_id bigint NOT NULL DEFAULT nextval('chan_grp_grpid_seq'::regclass),
  name character varying(100) NOT NULL,
  eng_id bigint NOT NULL,
  descr character varying(100),
  enabling_chan_id bigint,
  CONSTRAINT chan_grp_pkey PRIMARY KEY (grp_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE chan_grp
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE chan_grp TO "p.zumbruch";
GRANT SELECT ON TABLE chan_grp TO epics;

-- Table: channel

-- DROP TABLE channel;

CREATE TABLE channel
(
  channel_id bigint NOT NULL DEFAULT nextval('channel_chid'::regclass),
  name character varying(100) NOT NULL,
  descr character varying(100),
  grp_id bigint,
  smpl_mode_id bigint,
  smpl_val double precision,
  smpl_per double precision,
  retent_id bigint,
  retent_val double precision,
  CONSTRAINT channel_pkey PRIMARY KEY (channel_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE channel
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE channel TO "p.zumbruch";
GRANT SELECT ON TABLE channel TO epics;

-- Table: enum_metadata

-- DROP TABLE enum_metadata;

CREATE TABLE enum_metadata
(
  channel_id bigint NOT NULL,
  enum_nbr integer,
  enum_val character varying(120),
  CONSTRAINT enum_metadata_channel_id_fkey FOREIGN KEY (channel_id)
      REFERENCES channel (channel_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE CASCADE
)
WITH (
  OIDS=FALSE
);
ALTER TABLE enum_metadata
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE enum_metadata TO "p.zumbruch";
GRANT SELECT ON TABLE enum_metadata TO epics;

-- Table: num_metadata

-- DROP TABLE num_metadata;

CREATE TABLE num_metadata
(
  channel_id bigint NOT NULL,
  low_disp_rng real,
  high_disp_rng real,
  low_warn_lmt real,
  high_warn_lmt real,
  low_alarm_lmt real,
  high_alarm_lmt real,
  prec integer,
  unit character varying(100) NOT NULL,
  CONSTRAINT num_metadata_pkey PRIMARY KEY (channel_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE num_metadata
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE num_metadata TO "p.zumbruch";
GRANT SELECT ON TABLE num_metadata TO epics;

-- Table: retent

-- DROP TABLE retent;

CREATE TABLE retent
(
  retent_id bigint NOT NULL DEFAULT nextval('retent_retentid_seq'::regclass),
  descr character varying(255) NOT NULL,
  CONSTRAINT retent_pkey PRIMARY KEY (retent_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE retent
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE retent TO "p.zumbruch";
GRANT SELECT ON TABLE retent TO epics;

-- Table: sample

-- DROP TABLE sample;

CREATE TABLE sample
(
  channel_id bigint NOT NULL,
  smpl_time timestamp without time zone NOT NULL,
  nanosecs bigint NOT NULL,
  severity_id bigint NOT NULL,
  status_id bigint NOT NULL,
  num_val integer,
  float_val double precision,
  str_val character varying(120),
  datatype character(1) DEFAULT ' '::bpchar,
  array_val bytea,
  CONSTRAINT sample_channel_id_fkey FOREIGN KEY (channel_id)
      REFERENCES channel (channel_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE CASCADE,
  CONSTRAINT sample_severity_id_fkey FOREIGN KEY (severity_id)
      REFERENCES severity (severity_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE CASCADE,
  CONSTRAINT sample_status_id_fkey FOREIGN KEY (status_id)
      REFERENCES status (status_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE CASCADE
)
WITH (
  OIDS=FALSE
);
ALTER TABLE sample
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE sample TO "p.zumbruch";
GRANT SELECT ON TABLE sample TO epics;

-- Index: sample_id_time

-- DROP INDEX sample_id_time;

CREATE INDEX sample_id_time
  ON sample
  USING btree
  (channel_id, smpl_time, nanosecs);

-- Table: severity

-- DROP TABLE severity;

CREATE TABLE severity
(
  severity_id bigint NOT NULL DEFAULT nextval('severity_sevid'::regclass),
  name character varying(100) NOT NULL,
  CONSTRAINT severity_pkey PRIMARY KEY (severity_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE severity
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE severity TO "p.zumbruch";
GRANT SELECT ON TABLE severity TO epics;

-- Table: smpl_eng

-- DROP TABLE smpl_eng;

CREATE TABLE smpl_eng
(
  eng_id bigint NOT NULL DEFAULT nextval('smpl_eng_engid_seq'::regclass),
  name character varying(100) NOT NULL,
  descr character varying(100) NOT NULL,
  url character varying(100) NOT NULL,
  CONSTRAINT smpl_eng_pkey PRIMARY KEY (eng_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE smpl_eng
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE smpl_eng TO "p.zumbruch";
GRANT SELECT ON TABLE smpl_eng TO epics;

-- Table: smpl_mode

-- DROP TABLE smpl_mode;

CREATE TABLE smpl_mode
(
  smpl_mode_id bigint NOT NULL,
  name character varying(100) NOT NULL,
  descr character varying(100) NOT NULL,
  CONSTRAINT smpl_mode_pkey PRIMARY KEY (smpl_mode_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE smpl_mode
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE smpl_mode TO "p.zumbruch";
GRANT SELECT ON TABLE smpl_mode TO epics;

-- Table: status

-- DROP TABLE status;

CREATE TABLE status
(
  status_id bigint NOT NULL DEFAULT nextval('status_statid'::regclass),
  name character varying(100) NOT NULL,
  CONSTRAINT status_pkey PRIMARY KEY (status_id),
  CONSTRAINT status_name_key UNIQUE (name)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE status
  OWNER TO "p.zumbruch";
GRANT ALL ON TABLE status TO "p.zumbruch";
GRANT SELECT ON TABLE status TO epics;


-- PeterZumbruch - 18 Dec 2015
Topic revision: r1 - 18 Dec 2015, PeterZumbruch
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Hades Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)