Skip to content

Instantly share code, notes, and snippets.

@thebapi
Last active March 20, 2023 13:00
Show Gist options
  • Save thebapi/000b57bbf3a2cfd3dbc0bfba7d0b57ca to your computer and use it in GitHub Desktop.
Save thebapi/000b57bbf3a2cfd3dbc0bfba7d0b57ca to your computer and use it in GitHub Desktop.

Revisions

  1. thebapi revised this gist Mar 20, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,6 @@ CREATE INDEX IF NOT EXISTS fki_alarm_log_control_device_fn
    (id_control_device ASC NULLS LAST);


    CREATE UNIQUE INDEX CONCURRENTLY "alarm-log-uniq-index"
    CREATE UNIQUE INDEX "alarm-log-uniq-index"
    ON public.alarmlog USING btree
    (incident_id ASC NULLS LAST);
  2. thebapi revised this gist Mar 20, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ CREATE TABLE IF NOT EXISTS public.alarmlog
    incident_id bigint NOT NULL,
    type smallint NOT NULL,
    property character varying(50) NOT NULL,
    acknowledgement_link text NOT NULL,
    CONSTRAINT alarmlog_pkey PRIMARY KEY (id_alarm_log),
    CONSTRAINT alarm_log_control_device_fn FOREIGN KEY (id_control_device)
    REFERENCES public.controldevice (id_control_device) MATCH SIMPLE
  3. thebapi revised this gist Mar 13, 2023. No changes.
  4. thebapi revised this gist Mar 13, 2023. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -28,4 +28,9 @@ CREATE INDEX IF NOT EXISTS alarm_ack_time_index

    CREATE INDEX IF NOT EXISTS fki_alarm_log_control_device_fn
    ON public.alarmlog USING btree
    (id_control_device ASC NULLS LAST);
    (id_control_device ASC NULLS LAST);


    CREATE UNIQUE INDEX CONCURRENTLY "alarm-log-uniq-index"
    ON public.alarmlog USING btree
    (incident_id ASC NULLS LAST);
  5. thebapi created this gist Mar 13, 2023.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    CREATE TABLE IF NOT EXISTS public.alarmlog
    (
    id_alarm_log bigserial NOT NULL,
    id_control_device bigint NOT NULL,
    asset_name character varying(50) NOT NULL,
    property_group_name character varying(50) NOT NULL,
    value double precision NOT NULL,
    unit character varying(5) NOT NULL,
    is_acknowledged boolean NOT NULL DEFAULT 'false',
    acknowledged_at double precision,
    alarm_activation_time double precision NOT NULL,
    incident_id bigint NOT NULL,
    type smallint NOT NULL,
    property character varying(50) NOT NULL,
    CONSTRAINT alarmlog_pkey PRIMARY KEY (id_alarm_log),
    CONSTRAINT alarm_log_control_device_fn FOREIGN KEY (id_control_device)
    REFERENCES public.controldevice (id_control_device) MATCH SIMPLE
    ON UPDATE NO ACTION
    ON DELETE NO ACTION
    NOT VALID
    );



    CREATE INDEX IF NOT EXISTS alarm_ack_time_index
    ON public.alarmlog USING btree
    (is_acknowledged ASC NULLS LAST, alarm_activation_time ASC NULLS LAST);

    CREATE INDEX IF NOT EXISTS fki_alarm_log_control_device_fn
    ON public.alarmlog USING btree
    (id_control_device ASC NULLS LAST);