Commit be766810 authored by Siiri Tann's avatar Siiri Tann
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. added new entities: OfficialInSequenceEntity and OfficialsSequenceEntity.
parents be14c23e ff7b0b59
theGroup=ee.sm.ti.teis
theVersion=1.10.1
commonsVersion=1.14.0
officeApiGatewayVersion=1.14.0
pluginVersion=1.2.0
theVersion=1.11.0-SNAPSHOT
commonsVersion=1.26.0-SNAPSHOT
officeApiGatewayVersion=1.25.0
pluginVersion=1.3.0
package ee.sm.ti.teis.officials.officialssequence;
import ee.sm.ti.teis.servicecommon.common.AuditedEntity;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Entity
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "official_in_sequence")
public class OfficialInSequenceEntity extends AuditedEntity {
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
@Column(name = "id", updatable = false, nullable = false)
private UUID id;
@NotNull
private UUID officialUserId;
@NotNull
private UUID officialsSequenceId;
@NotNull
private Boolean active;
@Enumerated(EnumType.STRING)
@Builder.Default
private ObjectStatus objectStatus = ObjectStatus.CURRENT;
}
package ee.sm.ti.teis.officials.officialssequence;
import ee.sm.ti.teis.servicecommon.common.AuditedEntity;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Entity
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "officials_sequence")
public class OfficialsSequenceEntity extends AuditedEntity {
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
@Column(name = "id", updatable = false, nullable = false)
private UUID id;
@NotBlank
private String code;
@NotBlank
private String title;
@NotNull
private UUID lastSelectedOfficialId;
@Enumerated(EnumType.STRING)
@Builder.Default
private ObjectStatus objectStatus = ObjectStatus.CURRENT;
}
--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)
);
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 INDEX officials_sequence_last_selected_official_id_idx ON officials_sequence (last_selected_official_id);
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)
);
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