annotate schema/updates/1433/01.add_state.sql @ 5624:29d729607ac1

Added tag v5.7 for changeset ff0af91a7f62
author Sascha Wilde <wilde@sha-bang.de>
date Thu, 22 Dec 2022 18:42:14 +0100
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';