db
CREATE TABLE public.erdb_staffs_new (
st_id serial NOT NULL,
st_district_id int2 NOT NULL,
st_rik_id int2 NOT NULL,
st_name varchar(4095) NOT NULL,
st_period varchar(65) NOT NULL,
st_period_begin date NOT NULL,
st_number varchar(65) NOT NULL,
st_date date NOT NULL,
st_agreed_comm varchar(4095) NULL,
st_agreed_date date NULL,
st_approved_date date NOT NULL,
st_order_date date NOT NULL,
st_order_num varchar(65) NOT NULL,
st_in_staff_num int4 NOT NULL,
st_monthly_payroll numeric(15,2) NOT NULL,
st_staff jsonb NOT NULL,
st_mcost numeric(15,2) NOT NULL,
st_award_multiplier varchar(3) NULL,
st_award_percent varchar(4) NULL,
st_agreed varchar(3) NULL DEFAULT 'No'::character varying,
st_who_agreed int8 NULL,
st_period_end date NULL,
st_active varchar(3) NOT NULL DEFAULT 'No'::character varying,
st_award_exact varchar(3) NULL,
st_award_percent_exact bool NULL DEFAULT false,
st_award_multiplier_exact bool NULL DEFAULT false,
CONSTRAINT erdb_staffs_new_pkey PRIMARY KEY (st_id)
);
CREATE TABLE public.erdb_staffs_positions (
stp_id serial NOT NULL,
stp_st_id int4 NOT NULL,
stp_sub_id int4 NULL,
stp_addition_id int4 NULL,
stp_num int4 NULL,
stp_salary numeric(15,2) NULL,
stp_percent_awards numeric(15,2) NULL,
stp_multiplier_awards numeric(15,2) NULL,
stp_note text NULL,
stp_job_duty text NULL,
CONSTRAINT erdb_staffs_positions_stp_id PRIMARY KEY (stp_id),
CONSTRAINT st_id FOREIGN KEY (stp_st_id) REFERENCES erdb_staffs_new(st_id)
);
CREATE TABLE public.erdb_staffs_members (
stm_id serial NOT NULL,
stm_st_id int4 NOT NULL,
stm_stp_id int4 NOT NULL,
stm_m_id int8 NULL,
stm_rate int2 NULL,
stm_m_fio varchar(256) NULL,
stm_payment_type int2 NULL,
stm_part_time_job int2 NULL,
stm_rik_experience varchar(255) NULL,
stm_employment_type int2 NULL,
stm_job_description_dir text NULL,
stm_job_description_file_name varchar(255) NULL,
stm_personal_awards int2 NULL,
stm_main_work_and_post text NULL,
stm_employment_date date NULL,
stm_is_substitution bool NULL DEFAULT false,
CONSTRAINT stm_id PRIMARY KEY (stm_id),
CONSTRAINT st_id FOREIGN KEY (stm_st_id) REFERENCES erdb_staffs_new(st_id),
CONSTRAINT stp_id FOREIGN KEY (stm_stp_id) REFERENCES erdb_staffs_positions(stp_id)
);