Commit b0b47c7d authored by Siiri's avatar Siiri
Browse files

TEIS-2185: added new tables: officials_sequence and official_in_sequence....

TEIS-2185: added new tables: officials_sequence and official_in_sequence. added data into officials_sequence.
parent be14c23e
--liquibase formatted sql
--changeset siiri:2021-06-03.TEIS-2185.add-officials-sequence
INSERT INTO officials_sequence (id, code, title, created_at, object_status)
VALUES
('a26b83e1-7f5b-44e9-9d08-36a2c70fa4fa', 'ACCIDENT_ADMINISTRATORS', 'Tööõnnetuste haldajad', now(), 'CURRENT');
--liquibase formatted sql
--changeset siiri:2021-06-03.TEIS-2185.add-new-tables
CREATE TABLE IF NOT EXISTS officials_sequence
(
id uuid NOT NULL,
code varchar(255),
title varchar(255),
last_selected_official_id uuid,
object_status varchar(255) NOT NULL,
created_at timestamp,
created_by varchar(255),
modified_at timestamp,
modified_by varchar(255),
modified_id varchar(255),
deleted_at timestamp,
deleted_id varchar(255)
);
ALTER TABLE officials_sequence ADD CONSTRAINT officials_sequence_pkey PRIMARY KEY (id);
ALTER TABLE officials_sequence ADD CONSTRAINT officials_sequence_last_selected_official_id_fkey foreign key (last_selected_official_id)
references official_user (id)
on update no action
on delete no action;
CREATE TABLE IF NOT EXISTS official_in_sequence
(
id uuid NOT NULL,
official_user_id uuid,
officials_sequence_id uuid,
active boolean,
object_status varchar(255) NOT NULL,
created_at timestamp,
created_by varchar(255),
modified_at timestamp,
modified_by varchar(255),
modified_id varchar(255),
deleted_at timestamp,
deleted_id varchar(255)
);
ALTER TABLE official_in_sequence ADD CONSTRAINT official_in_sequence_pkey PRIMARY KEY (id);
ALTER TABLE official_in_sequence ADD CONSTRAINT official_in_sequence_official_user_id_fkey foreign key (official_user_id)
references official_user (id)
on update no action
on delete no action;
ALTER TABLE official_in_sequence ADD CONSTRAINT official_in_sequence_officials_sequence_fkey foreign key (officials_sequence_id)
references officials_sequence (id)
on update no action
on delete no action;
CREATE INDEX official_in_sequence_official_user_id_idx ON official_in_sequence (official_user_id);
CREATE INDEX official_in_sequence_officials_sequence_id_idx ON official_in_sequence (officials_sequence_id);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment