How to store site wide settings in a database?

前端 未结 9 2855
时光说笑
时光说笑 2021-02-19 10:08

I\'m debating three different approaches to to storing sitewide settings for a web application.

A key/value pair lookup table, each key represents a setting.

    <
9条回答
  •  别那么骄傲
    2021-02-19 10:47

    Since your question is tagged with database/sql I presume you'd have no problem accessing an sql table for both lookup and management of settings... Guessing here, but I'd start with a table like:

    settingName  value   can_be_null   minvalue maxvalue  description
    TheAnswer      42       no            1       100     this setting does...
    ...
    

    If you think about managing a large number of settings, there's more information you need about each one of them than just their current value.

提交回复
热议问题