Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Merge requests
!408
Feature/update v3 migrations
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/update v3 migrations
feature/update-v3-migrations
into
develop
Overview
0
Commits
2
Pipelines
1
Changes
2
Merged
Karel van Klink
requested to merge
feature/update-v3-migrations
into
develop
2 months ago
Overview
0
Commits
2
Pipelines
1
Changes
2
Expand
Update and add one migration for migrating to v3
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
66028d2e
2 commits,
2 months ago
2 files
+
81
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
gso/migrations/versions/2025-04-10_c38adde1a18e_update_wf_in_process_table.py
+
43
−
1
Options
"""
Update w
f
in process table and delete old workflows
"""
Update w
orkflows
in process table and delete old
processes and
workflows
Revision ID: c38adde1a18e
Revision ID: c38adde1a18e
Revises: 9fbb3c4411ea
Revises: 9fbb3c4411ea
@@ -85,7 +85,49 @@ WHERE pr.pid = ps.pid
@@ -85,7 +85,49 @@ WHERE pr.pid = ps.pid
for
mapping
in
update_mappings
:
for
mapping
in
update_mappings
:
conn
.
execute
(
sa
.
text
(
sql_template
),
mapping
)
conn
.
execute
(
sa
.
text
(
sql_template
),
mapping
)
# Delete input states referencing to orphaned workflows.
conn
.
execute
(
sa
.
text
(
"""
DELETE FROM input_states
WHERE input_states.pid IN (SELECT p.pid
FROM processes p
JOIN workflows w
ON p.workflow_id = w.workflow_id
JOIN processes_subscriptions ps
ON ps.pid = p.pid
JOIN subscriptions s
ON s.subscription_id = ps.subscription_id
JOIN products pro
ON s.product_id = pro.product_id
WHERE w.
"
name
"
=
'
validate_prefix_list
'
AND pro.
"
name
"
!=
'
GÉANT IP
'
);
"""
)
)
# Delete processes refering to orphaned workflows.
conn
.
execute
(
sa
.
text
(
"""
DELETE FROM processes
WHERE processes.pid IN (SELECT p.pid
FROM processes p
JOIN workflows w
ON p.workflow_id = w.workflow_id
JOIN processes_subscriptions ps
ON ps.pid = p.pid
JOIN subscriptions s
ON s.subscription_id = ps.subscription_id
JOIN products pro
ON s.product_id = pro.product_id
WHERE w.
"
name
"
=
'
validate_prefix_list
'
AND pro.
"
name
"
!=
'
GÉANT IP
'
);
"""
)
)
# Delete workflows for products that no longer exist.
conn
.
execute
(
conn
.
execute
(
sa
.
text
(
sa
.
text
(
"""
"""
Loading