19.1.36. camcops_server.cc_modules.cc_serversettings¶
Copyright (C) 2012-2018 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CamCOPS.
CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.
Previously, we had a key/value pair system, both for device stored variables (table “storedvars”) and server ones (“_server_storedvars”). We used a “type” column to indicate type, and then columns named “valueInteger”, “valueText”, “valueReal” for the actual values.
Subsequently
- There’s no need for devices to upload their settings here, so that table goes.
- The server stored vars stored
idDescription1 - idDescription8 } now have their own table
idShortDescription1 - idShortDescription8 }
idPolicyUpload } now part of Group definition
idPolicyFinalize }
lastAnalyticsSentAt now unused
serverCamcopsVersion unnecessary (is in code)
databaseTitle still needed somehow
So, two options: https://stackoverflow.com/questions/2300356/using-a-single-row-configuration-table-in-sql-server-database-bad-idea # noqa
Let’s use a single row, based on a fixed PK (of 1).
On some databases, you can constrain the PK value to enforce “one row only”; MySQL isn’t one of those.