annotate schema/updates/1433/01.add_state.sql @ 5425:345515bc4548 marking-single-beam

Make GeoServer layer sounding_results_marking_points_geoserver working.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 09 Jul 2021 22:03:44 +0200
parents 38491057807b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5106
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
1 -- DROP and re-CREATE type because adding a value isn't possible in transaction
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
2 -- https://www.postgresql.org/docs/11/sql-altertype.html#id-1.9.3.42.7
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
3
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
4 ALTER TABLE import.imports
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
5 ALTER COLUMN state DROP DEFAULT,
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
6 ALTER COLUMN state TYPE varchar;
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
7
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
8 DROP TYPE import_state;
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
9
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
10 CREATE TYPE import_state AS ENUM (
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
11 'queued',
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
12 'running',
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
13 'failed', 'unchanged', 'pending',
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
14 'accepted', 'declined', 'reviewed'
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
15 );
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
16
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
17 ALTER TABLE import.imports
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
18 ALTER COLUMN state TYPE import_state USING CAST(state AS import_state),
13fff84c2b70 Fix database migration
Tom Gottfried <tom@intevation.de>
parents: 5097
diff changeset
19 ALTER COLUMN state SET DEFAULT 'queued';