N
N
nurzhannogerbek2019-02-19 15:33:21
PostgreSQL
nurzhannogerbek, 2019-02-19 15:33:21

Is it possible to bind a session with a poll?

The task is to create an anonymous questionnaire. That is, send a link to the questionnaire to the mail of company employees, but store the answers in the database (PostgreSQL) anonymously. Each employee can take the survey only once. The survey is active only for a certain period. I'm trying to create a proper questionnaire structure in a PostgreSQL database. How exactly to implement this very anonymity?
There is an essence "Опрос". There is an essence "Вопрос".
Now I did it like this. One survey can contain several questions. In this case, one question can be used in several surveys. Everything is clear here, this is a many-to-many connection.
I understand correctly that in order to implement anonymity, the survey needs to be tied to the session? How will it look within the framework of the database structure?
There is an entity "Question". The table looks like this:

CREATE TABLE QUESTIONS(
  ID SERIAL PRIMARY KEY NOT NULL,
  TEXT TEXT NOT NULL
);

There is an entity "Poll". The table looks like this:
CREATE TABLE SURVEYS(
  ID UUID PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
  NAME VARCHAR NOT NULL,
  DESCRIPTION TEXT,
  START_PERIOD TIMESTAMP,
  END_PERIOD TIMESTAMP,
  ACTIVE BOOLEAN NOT NULL
);

An intermediate table for a many-to-many relationship.
CREATE TABLE SURVEYS_QUESTIONS(
  ID SERIAL,
  	SURVEY_ID UUID NOT NULL,
  	QUESTION_ID INT NOT NULL,
  PRIMARY KEY (ID),
  FOREIGN KEY (SURVEY_ID) REFERENCES SURVEYS (ID) ON DELETE CASCADE,
  FOREIGN KEY (QUESTION_ID) REFERENCES QUESTIONS (ID) ON DELETE CASCADE
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2019-02-19
@tsklab

How exactly to implement this very anonymity?
Don't bind the responder to the session. Only a unique name (the employee chooses himself) and a password.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question