Best table design for application configuration or application option settings?

后端 未结 12 2535
说谎
说谎 2020-12-25 10:01

I need to store a series of configuration values in a database. A couple ways I thought of to store them are: a table with 2 colums(name,value) and a row for each pair, or

12条回答
  •  Happy的楠姐
    2020-12-25 10:34

    I have used both methods and I prefer the 2 column method. The draw back to the a new column for each configuration is that you need to change code to add new settings.

    I do prefer to use the One column per setting method (when I am accessing the value). This is because the configuration settings are more explicitly set. But that that preference does not out weigh the difficulty of adding a new configuration to the table.

    I would recommend the 2 column method. Then setup an accessor function/sproc to get at the values.

提交回复
热议问题