Вопрос

You are building an application that uses a database. For example, it is a marketing/sales software. The application allows user to create scenarios, one user may choose a different path to improve the company's sales, other user may choose another path. Each user's scenario is saved in the database, they can load their scenarios from database whenever they want and continue working on it. The question is: how does the application alter the database? For example, there is a table "sales". User 1 has a scenario, and he has different values in "sales" table, and user 2 may have completely different values. Would application create different copies of sales table for each scenario? Such as sales_scenario_1 and sales_sceneario_2? How are these kind of applications built?

Это было полезно?

Решение

You create a table with dynamic values:

sales
  ID,
  ...

sales_properties
  sales_FK,
  name,
  value

I would never change the database structure as part of normal application usage. You wouldn't be able to handle the different database models.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top