Database table structure for user settings

前端 未结 2 1093
悲&欢浪女
悲&欢浪女 2021-01-07 05:16

I need to add a table to store user settings. For the first time users will have about 10 different settings, but I\'m sure there will be more.

What scalable structu

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 06:03

    Depends on the settings.
    If it's just flags, you can use bit mask.

    If it's strings - just make separate fields.
    Do not make it "scalable". Databases must be scalable in length (and they are), not in width.
    Just plan your database structure before starting a code.

    If it will be poor plan - OK, you can add a few fields later. But do not make it on regular basis. It's a sign of poor database design.

提交回复
热议问题