Answer the question
In order to leave comments, you need to log in
How to properly design a blacklist?
There are buyers, there are sellers... The
buyer can blacklist the seller for themselves, and the seller can blacklist the buyer...
The problem is that I don't quite understand how to design this correctly.
In my head something like this:
Table black_list:
user_id - who blocked
locked_id - who was blocked
data_locked - date of blocking
Everything is simple and the question is basically stupid, but is it necessary to create a separate table?
This is about the same as with friends, I won’t store all this data in the users table, right?
Tell me if I'm wrong..
Answer the question
In order to leave comments, you need to log in
Well, it's worth storing "data" differently than the UNIX timestamp's time.
And in general in English "date" will be more correct.
And so you are right - a separate table is best suited for this.
The Buyer-Seller relationship is many-to-many. Accordingly, to implement a many-to-many relationship, a separate table will be needed. But the seller and buyer black list tables can be combined:
BlackList :
-- Customer_id int (Customer, Buyer)
-- Seller_id int (Seller)
-- type bool ( b'0 - buyer entered, b'1 - seller entered),
-- timestamp int (time stamp)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question