Skip to content
Snippets Groups Projects
Commit 5d113715 authored by Daniel Lyons's avatar Daniel Lyons
Browse files

A trick to get past the update issues, hopefully

parent 7fd8ee1b
No related branches found
No related tags found
1 merge request!595A trick to get past the update issues, hopefully
Pipeline #3330 passed
......@@ -27,6 +27,11 @@ def upgrade():
UPDATE capability_executions SET capability_name = v.capability_name FROM capability_versions v
WHERE capability_executions.capability_version_number = v.version_number AND capability_executions.capability_request_id = v.capability_request_id;
ALTER TABLE capability_executions ALTER COLUMN capability_name SET NOT NULL;
UPDATE capability_executions
SET state = new_state.new_state
FROM (VALUES ('ExecutingWorkflow', 'Executing'), ('Created', 'Start'), ('Waiting', 'Queued'), ('Awaiting QA', 'Complete')) new_state(old_state, new_state)
WHERE state = new_state.old_state;
ALTER TABLE capability_executions ADD CONSTRAINT capability_execution_state_fkey FOREIGN KEY (capability_name, state) REFERENCES capability_states(capability_name, state);
"""
......@@ -38,5 +43,10 @@ def downgrade():
"""
ALTER TABLE capability_executions DROP COLUMN capability_name;
ALTER TABLE capability_versions DROP COLUMN capability_name;
UPDATE capability_executions
SET state = new_state.old_state
FROM (VALUES ('ExecutingWorkflow', 'Executing'), ('Created', 'Start'), ('Waiting', 'Queued'), ('Awaiting QA', 'Complete')) new_state(old_state, new_state)
WHERE state = new_state.new_state;
"""
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment