Database design for user settings

前端 未结 5 569
误落风尘
误落风尘 2020-12-02 04:30

Which of the following options, if any, is considered best practice when designing a table used to store user settings?

(OPTION 1)

USER_SETTINGS
-Id         


        
5条回答
  •  没有蜡笔的小新
    2020-12-02 04:38

    Each option has its place, and the choice depends on your specific situation. I am comparing the pros and cons for each option below:

    Option 1: Pros:

    • Can handle many options
    • New options can easily be added
    • A generic interface can be developed to manage the options

    Option 1: Cons

    • When a new option is added, its more complex to update all user accounts with the new option
    • Option names can spiral out of control
    • Validation of allowed option values is more complex, additional meta data is needed for that

    Option 2: Pros

    • Validation of each option is easier than option 1 since each option is an individual column

    Option 2: Cons

    • A database update is required for each new option
    • With many options the database tables could become more difficult to use

提交回复
热议问题