How do you structure config data in a database?

后端 未结 18 1256
后悔当初
后悔当初 2021-01-31 04:37

What is people\'s prefered method of storing application configuration data in a database. From having done this in the past myself, I\'ve utilised two ways of doing it.

18条回答
  •  后悔当初
    2021-01-31 05:02

    I use a mix of option 2 and XML columns in SQL server. You may also wan't to add a check constraint to keep the table at one row.

    CREATE TABLE [dbo].[MyOption] (
      [GUID] uniqueidentifier CONSTRAINT [dfMyOptions_GUID] DEFAULT newsequentialid()  ROWGUIDCOL NOT NULL,
      [Logo] varbinary(max) NULL,
      [X] char(1)  CONSTRAINT [dfMyOptions_X] DEFAULT 'X' NOT NULL,
      CONSTRAINT [MyOptions_pk] PRIMARY KEY CLUSTERED ([GUID]),
      CONSTRAINT [MyOptions_ck] CHECK ([X]='X')
    )
    

提交回复
热议问题