database - django db schema - creating tasks of different types, each w/ different fields -


What is the best DB design using the DEGENGO for the following scenario:

I have a In the database, there are different tasks with different areas for the computer to be executed from the computer. For example, a "can install a program", in which the program table has a foreign key , Where the entries are Is privy to the village installed. Or it may be like "changing settings", which has the foreign key in the installation table.

I was thinking of having a task type (name, description), but to perform the above work, everyone has the foreign key of the program and settings, even if this work is not used either. It does not look the best ... Is there any other way?

As stated, your ideological schema is included in

  • Actions exists
  • Computer exists
  • Settings < Computers
  • Tasks
  • Tasks
  • Tasks Tasks
  • < Strong> work is to install work >

    You also see an obstacle, Decide how important it is:

    • | Join P6 P6 | There are no tasks to install Programs and Settings

      give some suggestions Natural sub-complexes - With the "Installtask" and "SettingsTask", a natural designation solution must be used to represent a basic "task" model. Then you can either take "computer" as a feature of the base class, or alternatively another model "computertask" or such

      using model succession will take some advantage, in which ( 1) To get some support to build the base work, as you make, say, change, and encourage (2), but do not apply, maintenance of the obstacle.

      However, in my experience, there are perceptual problems with model succession, and you can experience stunning and unwanted behavior, for example, updating tasks. In this situation, I can just keep the work 1: 1 with InstallTask ​​and 1: 1 with SetTestTask. It's actually more flexible.

Comments