Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2014
    Posts
    2

    Question Seeking assistance with DB design

    Hello,

    I am developing a website that has Employers that post shifts, and Job Seekers (Employees) that search and apply for shifts. The way I had planned the database initially was like so:

    Employers (user_id) <- Users -> shift_user -> Shifts
    Employee (user_id) <- Users -> shift_user -> Shifts

    So the user, upon signup, can either opt to be an employer or an employee. If they are an employer they can post shifts, i they are an employee they can apply for shifts.

    The other way I thought to do this was to have employee_shift and employer_shift tables, and make the links directly instead of through the user table. But I just thought having it all tied to the Users table made more sense.

    Can anyone think of a better way to structure this database?

    Cheers

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    At least to me, "better" means that it meets your needs more precisely. Since you understand your needs, only you can make that judgement.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Aug 2014
    Posts
    2

    Question

    Hi Pat,

    thanks for the reply.

    I am actually having trouble extracting the required information using the above structure. I can get a list of all the shifts + their employers information and I can filter the output by employer information (State, Post Code, etc), however I can't filter by information associated with the Shifts (Rate, Category, etc). I am using Laravel to talk to the database, so either this is just a limitation of the framework or the way I have the database configured can't give me what I want.

    For example, I have an output like this

    Employer1
    Shift1 - $25/hr
    Shift2 - $70/hr

    Employer2
    Shift1 - $35/hr
    Shift2 - $45/hr
    Shift3 - $20/hr

    An example transformation would be: remove all shifts that have a rate of < $50/hr.

    Is that possible to perform with my current db setup?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •