DROP TABLE messages_properties; CREATE TABLE messages_properties ( message_id bigint NOT NULL, reply_id smallint NOT NULL, property_key character varying(255) NOT NULL, property_value text NOT NULL, CONSTRAINT message_properties_key UNIQUE(message_id, reply_id, property_key) )