messages.sql 897 B

123456789101112131415
  1. CREATE TABLE IF NOT EXISTS vote.messages
  2. (
  3. date_creation timestamp without time zone NOT NULL DEFAULT now(),
  4. numero_message integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  5. numero_participant integer NOT NULL,
  6. numero_destinataire integer,
  7. ligne character varying(4000) COLLATE pg_catalog."default",
  8. CONSTRAINT fk_numeroParticipantMessage FOREIGN KEY(numero_participant) REFERENCES vote.participants(numero_participant),
  9. CONSTRAINT fk_numeroDestinataireMessage FOREIGN KEY(numero_destinataire) REFERENCES vote.participants(numero_participant)
  10. )
  11. TABLESPACE vote;
  12. ALTER TABLE IF EXISTS vote.messages OWNER to vote;
  13. CREATE INDEX IF NOT EXISTS ix_numeroParticipantMessage ON vote.messages USING btree (numero_participant) TABLESPACE vote;
  14. CREATE INDEX IF NOT EXISTS ix_numeroDestinataireMessage ON vote.messages USING btree (numero_destinataire) TABLESPACE vote;