Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should 'system data' be in a database?

I have designed a database for an application which contains user settings. This database will come preloaded with several system user settings. These may change from version to version. How should I deal with updating these settings?

The solutions I came up with:

  1. Apply a boolean 'system' field to the settings tables and replace all system settings when the version number of the database changes. (which is very annoying while designing these settings as you have to constantly wipe the database while developing)
  2. Don't put system settings in the database and somehow merge the system data with data from the database when querying them.

Currently I'm doing the first, but somehow the 2nd seems more appropriate. What should I do and how can I seamlessly union external data with data from a database when using the Microsoft Entity Framework?

like image 888
Wouter Avatar asked May 19 '26 00:05

Wouter


1 Answers

Since there is a large number of operations you may end up wanting to perform on the data beyond a simple union (inner and outer joins to see who matches system settings or doesn't spring to mind) I'd suggest putting the system data in the same structure as the user data.

This also allows behaviours like filling in defaults from system data when user's don't have a particular value.

There are some interesting points about managing settings and overrides in this blog post if you've got the time to read something quite that long.

like image 56
Bell Avatar answered May 21 '26 15:05

Bell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!