Skip to content

Commit b8645cd

Browse files
committed
Added changelog to clean old tests from catalog
1 parent e146200 commit b8645cd

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
5+
<changeSet id="clean-old-tests" author="kevinmessiaen">
6+
<sql>
7+
DELETE
8+
FROM test_function_arguments tfa
9+
WHERE tfa.function_uuid IN (SELECT cf.uuid
10+
FROM callable_functions cf
11+
WHERE cf.callable_type = 'TEST'
12+
AND cf.module LIKE 'giskard.ml_worker.testing.tests.%');
13+
DELETE
14+
FROM suite_test_execution ste
15+
WHERE ste.test_id IN (SELECT st.id
16+
FROM suite_test st
17+
JOIN callable_functions cf
18+
ON cf.uuid = st.test_function_uuid
19+
WHERE cf.callable_type = 'TEST'
20+
AND cf.module LIKE 'giskard.ml_worker.testing.tests.%');
21+
DELETE
22+
FROM test_input ti
23+
WHERE ti.suite_test_id IN (SELECT st.id
24+
FROM suite_test st
25+
JOIN callable_functions cf
26+
ON cf.uuid = st.test_function_uuid
27+
WHERE cf.callable_type = 'TEST'
28+
AND cf.module LIKE 'giskard.ml_worker.testing.tests.%');
29+
DELETE
30+
FROM suite_test st
31+
WHERE st.test_function_uuid IN (SELECT cf.uuid
32+
FROM callable_functions cf
33+
WHERE cf.callable_type = 'TEST'
34+
AND cf.module LIKE 'giskard.ml_worker.testing.tests.%');
35+
DELETE
36+
FROM callable_functions cf
37+
WHERE cf.callable_type = 'TEST'
38+
AND cf.module LIKE 'giskard.ml_worker.testing.tests.%'
39+
</sql>
40+
</changeSet>
41+
</databaseChangeLog>

backend/src/main/resources/config/liquibase/master.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
<include file="config/liquibase/changelog/20230614134137_changelog.xml" relativeToChangelogFile="false"/>
2929
<include file="config/liquibase/changelog/20230622130823_changelog.xml" relativeToChangelogFile="false"/>
3030
<include file="config/liquibase/changelog/20230705162357_changelog.xml" relativeToChangelogFile="false"/>
31+
<include file="config/liquibase/changelog/clean_old_tests.xml" relativeToChangelogFile="false"/>
3132
</databaseChangeLog>

0 commit comments

Comments
 (0)