Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While there are lots of cases where referencing "through" foreign key relations would be useful, this specific example is one for which dereferencing & check seems to be LESS convenient that what is available today with just composite foreign keys.

  CREATE TABLE permission_overrides (
    -- (...)
    granted_in_tenant_id BIGINT NOT NULL,
    granted_by_user_id BIGINT NOT NULL,
    granted_to_user_id BIGINT NOT NULL,
    FOREIGN KEY (granted_by_user_id, granted_in_tenant_id) REFERENCES users (id, tenant_id),
    FOREIGN KEY (granted_to_user_id, granted_in_tenant_id) REFERENCES users (id, tenant_id)
  );


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: