-- Add up migration script here
CREATE TABLE perms (
  id INTEGER GENERATED ALWAYS AS IDENTITY,
  list_id INTEGER NOT NULL, -- the list affected by the permission
  user_id INTEGER NOT NULL, -- the user affected by the permission
  read BOOLEAN NOT NULL, -- can the user read the list
  write BOOLEAN NOT NULL, -- can the user write to the list
  CONSTRAINT fk_list
    FOREIGN KEY(list_id)
    REFERENCES list(id),
  CONSTRAINT fk_user
    FOREIGN KEY(user_id)
    REFERENCES users(id)
);
