G
G
GeKskill2020-05-26 12:26:54
Database design
GeKskill, 2020-05-26 12:26:54

How does Habr store notification settings?

I somehow need to save all the checkboxes marked by the user, and new ones can be constantly added (these are the categories for which the user needs to be notified). I understand that you need to store something like this (create it with status 0 by trigger), but then why store unnecessary data with status 0:

user_id | category_id | status
     1               1                0 
     1               2                1 
     2               1                1
     2               2                0

I wonder how this is implemented here, on Habré, in the notification settings (is it just a JSON string stored in the database?) Or does the PHP script somehow check the received data through the conditions and make a separate query to the database for each parameter?
Passing JSON like: notification[tracker][my_question_clarification]: 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2020-05-26
@GeKskill

It is possible to operate that - 1 = "is", 0 - "no"
That is, there will be no records for unchecked checkboxes in the database at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question