D
D
Dmitry2015-09-23 13:23:15
MySQL
Dmitry, 2015-09-23 13:23:15

What is the best way to implement the history of actions?

There is some task, to create a sequence of actions in the database. Immediately the thought came to mind that this does not seem to be a comment system. However, is it worth adapting the comment system to such a task?
There is another idea to use pID for each entry, would such an implementation work?
For example - a person bought a pencil, then he exchanged it for a colored pencil, then he exchanged it for a ballpoint pen, and so on. However, such a person should be able to have more than one sequence.
I don't think I can think of a better example.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2015-09-23
@Nipheris

For example - a person bought a pencil, then he exchanged it for a colored pencil, then he exchanged it for a ballpoint pen, and so on.

This is commonly referred to as the action story, "history" being the key word. Here's a variant of the action history table entry:
[<subject> | <sequence number> | <datetime>] | <object> | <action>
What's in sq. parentheses - record key.
If you tell in more detail what you are doing - who is the subject, what actions are performed - we will also offer a more specific table schema.

J
jsse, 2015-09-23
@jsse

the simplest option is to use a tree, where each end node will be the last action.
this way you can pick up the story (ancestors) at any time or build the whole picture in the form of a tree.
i would recommend mptt for django, but there are simpler solutions as well

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question