-- public.core_messages definition

-- Drop table

-- DROP TABLE public.core_messages;

CREATE TABLE public.core_messages (
	id bigserial NOT NULL,
	message_type varchar(5) NOT NULL,
	sender_id int4 NOT NULL DEFAULT 0,
	sender text NOT NULL,
	recipients text NOT NULL,
	subject varchar(255) NOT NULL DEFAULT 'no_subject'::character varying,
	message_body text NOT NULL,
	body_md5 varchar(32) NULL ,
	sent bool NOT NULL DEFAULT false,
	created_on timestamp NULL,
	sent_on timestamp NULL,
	status varchar(3),
	meta jsonb DEFAULT '{}'::json,
	queued date NULL DEFAULT now()
);
CREATE UNIQUE INDEX core_messages_id_idx ON public.core_messages USING btree (id);
CREATE UNIQUE INDEX core_messages_message_type_idx ON public.core_messages USING btree (message_type, sender_id, sender, recipients, subject, queued, body_md5);



