Mercurial > gemma
changeset 4461:7128741faeb9
Changed fa data to accept "position" as strings, not a 2char "position_code"
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Mon, 23 Sep 2019 12:59:48 +0200 |
parents | ace7c8d6290d |
children | 2793893bc7f5 |
files | pkg/imports/fa.go schema/gemma.sql schema/updates/1203/01.fa_fix_position_field.sql schema/version.sql |
diffstat | 4 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/fa.go Mon Sep 23 11:34:06 2019 +0200 +++ b/pkg/imports/fa.go Mon Sep 23 12:59:48 2019 +0200 @@ -68,7 +68,7 @@ insertFASQL = ` INSERT INTO waterway.fairway_availability ( - position_code, + position, bottleneck_id, surdat, critical, @@ -82,7 +82,7 @@ $5, $6 ) ON CONFLICT (bottleneck_id, surdat) DO UPDATE SET - position_code = EXCLUDED.position_code, + position = EXCLUDED.position, critical = EXCLUDED.critical, date_info = EXCLUDED.date_info, source_organization = EXCLUDED.source_organization
--- a/schema/gemma.sql Mon Sep 23 11:34:06 2019 +0200 +++ b/schema/gemma.sql Mon Sep 23 12:59:48 2019 +0200 @@ -704,7 +704,7 @@ -- CREATE TABLE fairway_availability ( id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, - position_code char(2) REFERENCES position_codes, + position varchar, bottleneck_id varchar NOT NULL, surdat date NOT NULL, UNIQUE (bottleneck_id, surdat),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/updates/1203/01.fa_fix_position_field.sql Mon Sep 23 12:59:48 2019 +0200 @@ -0,0 +1,20 @@ +-- This is Free Software under GNU Affero General Public License v >= 3.0 +-- without warranty, see README.md and license for details. + +-- SPDX-License-Identifier: AGPL-3.0-or-later +-- License-Filename: LICENSES/AGPL-3.0.txt + +-- Copyright (C) 2019 by via donau +-- – Österreichische Wasserstraßen-Gesellschaft mbH +-- Software engineering by Intevation GmbH + +-- Author(s): +-- * Sascha Wilde <sascha.wilde@intevation.de> + +ALTER TABLE waterway.fairway_availability + ADD COLUMN IF NOT EXISTS position varchar; + +UPDATE waterway.fairway_availability SET position = position_code; + +ALTER TABLE waterway.fairway_availability + DROP COLUMN IF EXISTS position_code;