Database Architecture for “Badge” System & Arbitrary Criteria (MySQL/PHP)

前端 未结 7 1257
一生所求
一生所求 2020-12-12 10:31

Quickie-Question:

To summarize, I\'m a little confused as to how I would design such a database that allows indefinite badge-rule creation without requiring structu

7条回答
  •  渐次进展
    2020-12-12 10:59

    I apologize for being brief.

    To implement a system such as this, I might create a table which stores either stored procedure names or actual queries that would be used to determine whether a particular user has earned a badge.

    badge_criteria
    badge_key int
    badge_criteria varchar(max)
    

    You can extract and execute the queries for badges which the user has not earned from your middle tier, but you would not have to make any code or structural changes to add new badges going forward.

提交回复
热议问题