On 23 May 2015, at 5:21pm, Rob Willett <rwillett at robertwillett.com> wrote:
> If we can force holiday_mode to be set to either 0 or 1 then the problem goes
> away, which comes down to getting the design right.
I don't know how your synchronisation works, but you can definitely make sure
only 'legal' values are stored in a column:
CREATE TABLE myTable (
holiday_mode INTEGER
DEFAULT 0
CHECK (holiday_mode = 0 OR holiday_mode = 1)
)
You don't need a DEFAULT constraint in there too, I just put it in to show it's
possible.
> I think that this ?issue? we have is indicative of a poor DB design and
> wrong assumptions (bad pun) and we should fix that.
In previous jobs I have inherited databases which would have required a lot of
work to fix in their current forms but would take care of themselves with
properly re-written schema. But sometimes you can't do that because it would
require retesting huge amounts of legacy code.
Simon.