Design Problem

Feedback - some general thoughts, given with the understanding that I am not familiar with the processing that needs to occur. These entities don’t exist in a vacuum - they exist only to support some type of data management needs. Those needs can and should greatly affect the design of the models.

So, working only from general principles while acknowledging my lack of knowledge:

  • There is no need for a Date table requiring other tables to join to it to identify a date. If there are special dates that need some sort of extra processing, the typical method is to have a “Calendar” object that can be referenced when needed as opposed to needing to access it for every date reference. (As one specific example - in your Ingredient table you have an M2M for the date_purchased and expiry_date - does it really matter to the date_purchased if it was a weekend or a holiday?)
  • Never, under any condition or circumstance, for absolutely no reason whatever, should you ever, ever even think about using FloatField for financial or financial-related fields. Not for costs, prices, totals, hours, rates, nothing - just don’t do it. Use the Decimal field for them.
  • You seem to have some redundancy in the Employee model between is_employed, is_employee, is_supervisor, is_manager. I’d be curious to understand the purpose of each of those with an eye toward determining if any are redundant or mutually exclusive to any of the others.
  • Schedule: scheduled_cost and actual_cost are derived fields. I wouldn’t store them in the table
  • Product: You’re not consistent with your boolean fields between tables. You established the idea of is_… in Employee but abandoned it here.
  • Ingredient: Naming conventions - date_purchased vs expiry_date. (Should perhaps be either purchase_date and expiry_date, or date_purchased and date_expires.)
  • Report: Again here you’re storing derived values when there’s no apparent need to do so. Also, are most_sold_product and most_products_sold_by FKs to Product and Employee?
  • TimeStamp: Are these “Sign in” and “Sign out” events for the website, or are they a reference to starting and stopping work?
  • Supplier: productType - inconsistent use of camelCase instead of underscore

So these are just a few thoughts on what jumped out at me while I was looking at this. Hope they give you some ideas for further refinements.