0

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)
001
  • 62,807
  • 94
  • 230
  • 350
  • Use either EAV or XMLType. I would perffer XML (at least if you're on EE). – ibre5041 Jun 09 '15 at 06:27
  • Suggest to not to use EAV. http://stackoverflow.com/questions/11779252/entity-attribute-value-table-design – sqluser Jun 09 '15 at 06:29
  • XML can work, especially if if you have a database with good XML support. Other approaches can work too. XML and other approaches have drawbacks too. It depends entirely on what your "settings" are and how you intend to use them. There is no canonical answer. – APC Jun 09 '15 at 06:32
  • If you don't need to search by any of the fields in the XML, just leave it as a TEXT (mysql) or CLOB (oracle) field. – Rick James Jun 10 '15 at 21:34

1 Answers1

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

Pavel Gatnar
  • 3,987
  • 2
  • 19
  • 29