diff --git a/src/client/app/components/admin/PreferencesComponent.tsx b/src/client/app/components/admin/PreferencesComponent.tsx index 6bbbe7c05..29a68ba5e 100644 --- a/src/client/app/components/admin/PreferencesComponent.tsx +++ b/src/client/app/components/admin/PreferencesComponent.tsx @@ -117,6 +117,19 @@ class PreferencesComponent extends React.Component +
+ +

diff --git a/src/server/migrations/0.5.0-0.6.0/sql/meter/add_gps_column.sql b/src/server/migrations/0.5.0-0.6.0/sql/meter/add_gps_column.sql index 89483b170..9092a682e 100644 --- a/src/server/migrations/0.5.0-0.6.0/sql/meter/add_gps_column.sql +++ b/src/server/migrations/0.5.0-0.6.0/sql/meter/add_gps_column.sql @@ -3,4 +3,4 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ALTER TABLE meters - ADD COLUMN IF NOT EXISTS gps POINT DEFAULT NULL; + ADD COLUMN IF NOT EXISTS gps POINT DEFAULT NULL; \ No newline at end of file diff --git a/src/server/migrations/0.5.0-0.6.0/sql/meter/add_identifier_column.sql b/src/server/migrations/0.5.0-0.6.0/sql/meter/add_identifier_column.sql index 38c9aba6b..1029b0d03 100644 --- a/src/server/migrations/0.5.0-0.6.0/sql/meter/add_identifier_column.sql +++ b/src/server/migrations/0.5.0-0.6.0/sql/meter/add_identifier_column.sql @@ -5,4 +5,4 @@ ALTER TABLE meters ADD COLUMN IF NOT EXISTS identifier TEXT; -UPDATE meters SET identifier=name WHERE identifier IS NULL or identifier=''; +UPDATE meters SET identifier=name WHERE identifier IS NULL or identifier=''; \ No newline at end of file diff --git a/src/server/migrations/0.7.0-0.7.1/index.js b/src/server/migrations/0.7.0-0.7.1/index.js new file mode 100644 index 000000000..fbc7be27d --- /dev/null +++ b/src/server/migrations/0.7.0-0.7.1/index.js @@ -0,0 +1,14 @@ +/* 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/. */ + +const database = require('../../models/database'); +const sqlFile = database.sqlFile; + +module.exports = { + fromVersion: '0.7.0', + toVersion: '0.7.1', + up: async db => { + await db.none(sqlFile('../migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql')); + } +}; \ No newline at end of file diff --git a/src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql b/src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql new file mode 100644 index 000000000..234c080f4 --- /dev/null +++ b/src/server/migrations/0.7.0-0.7.1/sql/preferences/alter_preferences_type.sql @@ -0,0 +1,14 @@ +/* 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/. */ + +-- See 0.6.0-0.7.0/add_meter_type.sql for more information on this migration. + +-- Move the currently named type to a temporary name. +ALTER TYPE graph_type RENAME TO graph_type_temp; +-- Create the type desired with new value, 'other' in this case but need to include old ones. +CREATE TYPE graph_type as enum ('line', 'bar', 'compare', 'map'); +-- Change the column in meters to use the new type with the current rows. +ALTER TABLE preferences ALTER COLUMN default_chart_to_render TYPE graph_type USING default_chart_to_render::text::graph_type; +-- Get rid of the old, temporary type that no longer needed. +DROP TYPE graph_type_temp; diff --git a/src/server/migrations/registerMigration.js b/src/server/migrations/registerMigration.js index bf27abaca..81fd45c56 100644 --- a/src/server/migrations/registerMigration.js +++ b/src/server/migrations/registerMigration.js @@ -10,7 +10,8 @@ const migrations = [ //require('./0.2.0-0.3.0-Template/indexTemplate'), require('./0.3.0-0.5.0'), require('./0.5.0-0.6.0'), - require('./0.6.0-0.7.0') + require('./0.6.0-0.7.0'), + require('./0.7.0-0.7.1') /* eslint-disable global-require */ ]; diff --git a/src/server/sql/preferences/create_graph_types_enum.sql b/src/server/sql/preferences/create_graph_types_enum.sql index d63641477..52a2d25e8 100644 --- a/src/server/sql/preferences/create_graph_types_enum.sql +++ b/src/server/sql/preferences/create_graph_types_enum.sql @@ -5,7 +5,7 @@ -- This should avoid an error when the type already exists. This is an issue since -- the OED install stops the creation of database items after this. DO $$ BEGIN - CREATE TYPE graph_type AS ENUM('line', 'bar', 'compare'); + CREATE TYPE graph_type AS ENUM('line', 'bar', 'compare', 'map'); EXCEPTION WHEN duplicate_object THEN null; END $$;