insert into sequpdate_state(updateid,uid) values('read status',10.0);

-- public.default_action_needed definition

-- Drop table

-- DROP TABLE public.default_action_needed;

CREATE TABLE public.default_action_needed (
	id int4 NOT NULL,
	document_type varchar NULL,
	staff_role_id int4 NULL,
	department_id int4 NULL,
	action int4 NOT NULL,
	CONSTRAINT default_action_needed_pkey PRIMARY KEY (id)
);


-- public.default_action_needed foreign keys

ALTER TABLE public.default_action_needed ADD CONSTRAINT default_action_needed_fk FOREIGN KEY (department_id) REFERENCES department(id);
ALTER TABLE public.default_action_needed ADD CONSTRAINT default_action_needed_fk_1 FOREIGN KEY (staff_role_id) REFERENCES staff_role(id);



-- public.read_status_link definition

-- Drop table

-- DROP TABLE public.read_status_link;

CREATE TABLE public.read_status_link (
	staff_member_id int4 NOT NULL,
	document_id int4 NOT NULL,
	last_opened timestamp NULL,
	read_at timestamp NULL,
	CONSTRAINT read_status_link_pk PRIMARY KEY (staff_member_id, document_id)
);


-- public.read_status_link foreign keys

ALTER TABLE public.read_status_link ADD CONSTRAINT read_status_link_fk FOREIGN KEY (staff_member_id) REFERENCES staff_member(id);
ALTER TABLE public.read_status_link ADD CONSTRAINT read_status_link_fk_1 FOREIGN KEY (document_id) REFERENCES document(id);