forked from cschleiden/go-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path000003_add_attributes_table.down.sql
More file actions
15 lines (11 loc) · 1.24 KB
/
Copy path000003_add_attributes_table.down.sql
File metadata and controls
15 lines (11 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ALTER TABLE activities ADD COLUMN attributes BYTEA, ALTER COLUMN attributes SET NULL;
UPDATE activities SET attributes = attributes.data FROM attributes WHERE activities.event_id = attributes.event_id AND activities.instance_id = attributes.instance_id AND activities.execution_id = attributes.execution_id;
ALTER TABLE activities ALTER COLUMN attributes TYPE BYTEA, ALTER COLUMN attributes SET NOT NULL;
ALTER TABLE history ADD COLUMN attributes BYTEA, ALTER COLUMN attributes SET NULL;
UPDATE history SET attributes = attributes.data FROM attributes WHERE history.event_id = attributes.event_id AND history.instance_id = attributes.instance_id AND history.execution_id = attributes.execution_id;
ALTER TABLE history ALTER COLUMN attributes TYPE BYTEA, ALTER COLUMN attributes SET NOT NULL;
ALTER TABLE pending_events ADD COLUMN attributes BYTEA, ALTER COLUMN attributes SET NULL;
UPDATE pending_events SET attributes = attributes.data FROM attributes WHERE pending_events.event_id = attributes.event_id AND pending_events.instance_id = attributes.instance_id AND pending_events.execution_id = attributes.execution_id;
ALTER TABLE pending_events ALTER COLUMN attributes TYPE BYTEA, ALTER COLUMN attributes SET NOT NULL;
-- Drop attributes table
DROP TABLE attributes;