-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/server/migrations/1.0.0-1.1.0/sql/meter/add_meter_pipeline_checks.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
-- Add meter pipeline check columns to the meters table. | ||
ALTER TABLE meters | ||
ADD COLUMN IF NOT EXISTS min_val DOUBLE PRECISION NOT NULL DEFAULT -9007199254740991 CHECK (min_val::DOUBLE PRECISION >= -9007199254740991), | ||
ADD COLUMN IF NOT EXISTS max_val DOUBLE PRECISION NOT NULL DEFAULT 9007199254740991 CHECK (max_val::DOUBLE PRECISION <= 9007199254740991), | ||
ADD COLUMN IF NOT EXISTS min_date TIMESTAMP NOT NULL DEFAULT '1970-01-01 00:00:00+00:00', | ||
ADD COLUMN IF NOT EXISTS max_date TIMESTAMP NOT NULL DEFAULT '6970-01-01 00:00:00+00:00', | ||
ADD COLUMN IF NOT EXISTS max_error INTEGER NOT NULL DEFAULT 75, | ||
ADD COLUMN IF NOT EXISTS disable_checks BOOLEAN DEFAULT false | ||
; |
24 changes: 24 additions & 0 deletions
24
src/server/migrations/1.0.0-1.1.0/sql/preferences/add_preferences_pipeline_checks.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
-- Add PREFERENCES pipeline check columns to the meters table. | ||
|
||
-- You need to set default so any existing rows get that value since NOT NULL. | ||
ALTER TABLE preferences | ||
ADD COLUMN IF NOT EXISTS default_meter_minimum_value DOUBLE PRECISION NOT NULL DEFAULT -9007199254740991, | ||
ADD COLUMN IF NOT EXISTS default_meter_maximum_value DOUBLE PRECISION NOT NULL DEFAULT 9007199254740991, | ||
ADD COLUMN IF NOT EXISTS default_meter_minimum_date TIMESTAMP NOT NULL DEFAULT '1970-01-01 00:00:00+00:00', | ||
ADD COLUMN IF NOT EXISTS default_meter_maximum_date TIMESTAMP NOT NULL DEFAULT '6970-01-01 00:00:00+00:00', | ||
ADD COLUMN IF NOT EXISTS default_meter_reading_gap REAL NOT NULL DEFAULT 0, | ||
ADD COLUMN IF NOT EXISTS default_meter_maximum_errors INTEGER NOT NULL DEFAULT 75 | ||
; | ||
-- Now remove default since not desired. | ||
ALTER TABLE preferences | ||
ALTER COLUMN default_meter_minimum_value DROP DEFAULT, | ||
ALTER COLUMN default_meter_maximum_value DROP DEFAULT, | ||
ALTER COLUMN default_meter_minimum_date DROP DEFAULT, | ||
ALTER COLUMN default_meter_maximum_date DROP DEFAULT, | ||
ALTER COLUMN default_meter_reading_gap DROP DEFAULT, | ||
ALTER COLUMN default_meter_maximum_errors DROP DEFAULT | ||
; |