Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Major simplification of event_* tables #344

Closed
hugotiburtino opened this issue Apr 26, 2024 · 2 comments · Fixed by #374
Closed

Major simplification of event_* tables #344

hugotiburtino opened this issue Apr 26, 2024 · 2 comments · Fixed by #374

Comments

@hugotiburtino
Copy link
Member

hugotiburtino commented Apr 26, 2024

Currently, the database structure regarding event is absurdly complex.

For example, to get the the parent of a checkout revision event we have to go through the event_parameter table and then to the event_parameter_uuid, besides that we have to see in the event_parameter_string the corresponding reason.

A much simpler way of dealing with it would be to have nullable columns in the event_log table. Or we could have just one table like event_data and have all info there. Anyway, we should figure out a simpler solution, of course with the corresponding db migration.

@kulla
Copy link
Member

kulla commented May 4, 2024

The following file contains all current descriptions of events:

https://github.com/serlo/api.serlo.org/blob/af1639f0a6e6e2ebca63083016cfa85ba103dfec/packages/server/src/schema/events/event.ts#L439-L533

There are at most two extra uuid_paramaters and at most one string parameter needed. A first easy simplification is to merge all extra event_* tables into one with the parameters:

  • uuid_parameter: Int or null
  • uuid_paramater2: Int or null
  • string_parameter: String or null

In case we need more sematic we can add uuid_parameter_type or uuid_parameter_type2... => However the semantics is set by https://github.com/serlo/api.serlo.org/blob/af1639f0a6e6e2ebca63083016cfa85ba103dfec/packages/server/src/schema/events/event.ts#L439-L533 in the conversion of the events

@kulla
Copy link
Member

kulla commented May 4, 2024

A next step might be to store JSON in the event table. Also the following renamings can be done:

  • Rename event_log into event
  • Rename event into event_type

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants