Skip to content

Commit 34a6d0f

Browse files
HMS-5145: remove epel 7 from migrations (#925)
Fixes 5145: remove epel 7 from migrations
1 parent 79e0a48 commit 34a6d0f

File tree

1 file changed

+54
-32
lines changed

1 file changed

+54
-32
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,61 @@
11
BEGIN;
22

3-
INSERT into repositories (uuid, url, status) values (gen_random_uuid(), 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/', 'Pending') ON CONFLICT DO NOTHING;
3+
INSERT INTO repositories (uuid, url, status) VALUES (
4+
gen_random_uuid(),
5+
'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/',
6+
'Pending'
7+
) ON CONFLICT DO NOTHING;
48
--- Update repo_configs and set the repo_uuid to the new url's repository, only if the repository_config is part of an org that does not also have the new url already
5-
UPDATE repository_configurations set repository_uuid = (select uuid from repositories where url = 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/')
6-
where repository_configurations.uuid in (
7-
select rc.uuid from repository_configurations rc
8-
inner join repositories on repositories.uuid = rc.repository_uuid
9-
where repositories.url = 'https://download-i2.fedoraproject.org/pub/epel/9/Everything/x86_64/' and
10-
rc.org_id not in (select org_id
11-
from repository_configurations rc2
12-
inner join repositories r2 on r2.uuid = rc2.repository_uuid
13-
where r2.url = 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/'));
9+
UPDATE repository_configurations SET
10+
repository_uuid
11+
= (
12+
SELECT uuid
13+
FROM repositories
14+
WHERE url = 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/'
15+
)
16+
WHERE repository_configurations.uuid IN (
17+
SELECT rc.uuid FROM repository_configurations AS rc
18+
INNER JOIN repositories ON rc.repository_uuid = repositories.uuid
19+
WHERE
20+
repositories.url
21+
= 'https://download-i2.fedoraproject.org/pub/epel/9/Everything/x86_64/'
22+
AND rc.org_id NOT IN (
23+
SELECT org_id
24+
FROM repository_configurations AS rc2
25+
INNER JOIN repositories AS r2 ON rc2.repository_uuid = r2.uuid
26+
WHERE
27+
r2.url
28+
= 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/'
29+
)
30+
);
1431

15-
INSERT into repositories (uuid, url, status) values (gen_random_uuid(), 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/', 'Pending') ON CONFLICT DO NOTHING;
32+
INSERT INTO repositories (uuid, url, status) VALUES (
33+
gen_random_uuid(),
34+
'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/',
35+
'Pending'
36+
) ON CONFLICT DO NOTHING;
1637

17-
UPDATE repository_configurations set repository_uuid = (select uuid from repositories where url = 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/')
18-
where repository_configurations.uuid in (
19-
select rc.uuid from repository_configurations rc
20-
inner join repositories on repositories.uuid = rc.repository_uuid
21-
where repositories.url = 'https://download-i2.fedoraproject.org/pub/epel/8/Everything/x86_64/' and
22-
rc.org_id not in (select org_id
23-
from repository_configurations rc2
24-
inner join repositories r2 on r2.uuid = rc2.repository_uuid
25-
where r2.url = 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/'));
26-
27-
28-
INSERT into repositories (uuid, url, status) values (gen_random_uuid(), 'https://dl.fedoraproject.org/pub/epel/7/x86_64/', 'Pending') ON CONFLICT DO NOTHING;
29-
UPDATE repository_configurations set repository_uuid = (select uuid from repositories where url = 'https://dl.fedoraproject.org/pub/epel/7/x86_64/')
30-
where repository_configurations.uuid in (
31-
select rc.uuid from repository_configurations rc
32-
inner join repositories on repositories.uuid = rc.repository_uuid
33-
where repositories.url = 'https://download-i2.fedoraproject.org/pub/epel/7/x86_64/' and
34-
rc.org_id not in (select org_id
35-
from repository_configurations rc2
36-
inner join repositories r2 on r2.uuid = rc2.repository_uuid
37-
where r2.url = 'https://dl.fedoraproject.org/pub/epel/7/x86_64/'));
38+
UPDATE repository_configurations SET
39+
repository_uuid
40+
= (
41+
SELECT uuid
42+
FROM repositories
43+
WHERE url = 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/'
44+
)
45+
WHERE repository_configurations.uuid IN (
46+
SELECT rc.uuid FROM repository_configurations AS rc
47+
INNER JOIN repositories ON rc.repository_uuid = repositories.uuid
48+
WHERE
49+
repositories.url
50+
= 'https://download-i2.fedoraproject.org/pub/epel/8/Everything/x86_64/'
51+
AND rc.org_id NOT IN (
52+
SELECT org_id
53+
FROM repository_configurations AS rc2
54+
INNER JOIN repositories AS r2 ON rc2.repository_uuid = r2.uuid
55+
WHERE
56+
r2.url
57+
= 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/'
58+
)
59+
);
3860

3961
COMMIT;

0 commit comments

Comments
 (0)