
\connect tasks;


CREATE TABLE task_manager.project (
  "id" SERIAL PRIMARY KEY UNIQUE,
  "name" TEXT NOT NULL,
  "description" TEXT NOT NULL,
  "date" TEXT NOT NULL DEFAULT now()
);

CREATE TABLE task_manager.user_project (
  "users" INTEGER NOT NULL,
  "projects" INTEGER NOT NULL,
  PRIMARY KEY ("users", "projects"),
  FOREIGN KEY ("projects") REFERENCES task_manager.project ("id") ON DELETE CASCADE,
  FOREIGN KEY ("users") REFERENCES task_manager.users ("id") ON DELETE CASCADE
);
