如何设计表来存储用户设置?

时间:2022-05-13 12:58:21

If its just for turning on and off a basic feature, this should be ok?

如果只是打开和关闭一个基本功能,这应该没问题?

USER_SETTINGS
-Id
-UserId
-SettingId
-IsEnabled

The problem is some settings require various fields...this could work, but is there a better way to do this?

问题是一些设置需要各种领域......这可能有效,但是有更好的方法吗?

USER_SETTINGS
-Id
-UserId
-SettingId
-XMLSettings (XML data of settings)

1 个解决方案

#1


1  

A. you can use nested table or object instead of XML on Oracle
B. you can create another table USER_SETTING_FIELD, which has foreign key to USER_SETTINGS
C. you can use simple string column with the format "field1:value1;field2:value2"
D. you can use extra SettingId for each field

答:您可以在Oracle B上使用嵌套表或对象而不是XML。您可以创建另一个表USER_SETTING_FIELD,它具有USER_SETTINGS C的外键。您可以使用格式为“field1:value1; field2:value2”D的简单字符串列你可以为每个字段使用额外的SettingId

#1


1  

A. you can use nested table or object instead of XML on Oracle
B. you can create another table USER_SETTING_FIELD, which has foreign key to USER_SETTINGS
C. you can use simple string column with the format "field1:value1;field2:value2"
D. you can use extra SettingId for each field

答:您可以在Oracle B上使用嵌套表或对象而不是XML。您可以创建另一个表USER_SETTING_FIELD,它具有USER_SETTINGS C的外键。您可以使用格式为“field1:value1; field2:value2”D的简单字符串列你可以为每个字段使用额外的SettingId