I'm working on a project that's due in 2 weeks and have hit a possibly serious roadblock. The app that I'm working on is some tuition reimbursement management system, whose use cases are dependent on the roles of the employee (user) trying to access it. It's a solo project, in which I was given a two-page document of some high-level requirements, involving the employee, the direct supervisor, the department head, and the benefits coordinator.
After a week of trying to plan it, and work on it, I came up with this: the
employees table has a foreign key to itself called
manager_id (an employee is a base user, then, iff there are no records such that
manager_id equals that employee's
employee_id), and a
department_roles_id that points to the
department_roles table that has a department and a
department_role_name. Here's a screenshot of my ERD for this
This approach, however, seems to have a problem. What happens when someone inserts an employee record into
employees, with the same
department_role_id as another record, but they have two different
manager_ids (for example, if one of them was a manager of that department but the other one wasn't)? How to avert this?
NOTE: if it helps any, I'm on Oracle 11g.