Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Merge requests
!595
A trick to get past the update issues, hopefully
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
A trick to get past the update issues, hopefully
fix-migration-issue
into
main
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Daniel Lyons
requested to merge
fix-migration-issue
into
main
3 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Viewing commit
5d113715
Show latest version
1 file
+
10
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
5d113715
A trick to get past the update issues, hopefully
· 5d113715
Daniel Lyons
authored
3 years ago
schema/versions/c3f9f47e7b4f_ws_717_fix_capability_name_foreign_keys.py
+
10
−
0
Options
@@ -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;
"""
)
Loading